vips-process 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c8e1e34b16c24916ce653fbfe90b964274f682a
4
- data.tar.gz: 73aaec174e1753e341b62d09071e1df0fdbacd16
3
+ metadata.gz: 59a91f48061d5e4937600eb21932952df50fd2db
4
+ data.tar.gz: 0f837c37c6fb38e2b59e6c6276694d3a620df659
5
5
  SHA512:
6
- metadata.gz: a3b161ce5417e820d6b41e69174df595119902fea500ccc7c0e18be1c07f058a2583d14b175b209ef406c96c68dca8f298f157227fbeb35239c04eb60ac9de3f
7
- data.tar.gz: d4168159430c88bc9a7dab8ad5ff0b5bc17e876900ad5fa5bf11d7c83ddaacfcd27b8f18c203e0cdbe1d9cd313b1e19679b2795d152c5a1ec1075ca0adeb9790
6
+ metadata.gz: eb19b085512ee9ce0ed901310ca6a23951de9d355266d49e94e1f88d935ab558665e3038f7c02c2df3a37b1a1fea85069fb276839eff4b6af4b02ed797b93d26
7
+ data.tar.gz: 4a9eae05b824e972aba6cd61dc76965e33684400aee8f4da2e85021ca5f6fe96870082853d6320052aee7a27b80bc8fe90e288efcb3b24709c4043373711fbed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vips-process (0.1.0)
4
+ vips-process (0.2.1)
5
5
  ruby-vips (~> 0.3.9)
6
6
 
7
7
  GEM
@@ -1,5 +1,5 @@
1
1
  module Vips
2
2
  module Process
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
data/lib/vips-process.rb CHANGED
@@ -105,8 +105,9 @@ module Vips
105
105
  def version(name, deps = [], &block)
106
106
  throw :need_block_or_deps unless block_given? || !deps.empty?
107
107
 
108
- @@_versions ||= {}
109
- @@_versions[name] = {deps: deps, block: block}
108
+ versions = begin class_variable_get(:@@_versions) rescue {} end
109
+ versions[name] = {deps: deps, block: block}
110
+ class_variable_set :@@_versions, versions
110
111
 
111
112
  define_method "#{name}_version" do |new_dst=nil, should_process=true|
112
113
  # Make sure we have a reference to the old version if it's being changed
@@ -114,12 +115,13 @@ module Vips
114
115
  old_dst = @dst
115
116
  @dst = new_dst
116
117
  end
118
+ _versions = class_variable_get :@@_versions
117
119
 
118
120
  # Recursively call dependencies but don't process them yet
119
- @@_versions[name][:deps].each { |dep| send "#{dep}_version", new_dst, false }
121
+ _versions[name][:deps].each { |dep| send "#{dep}_version", new_dst, false }
120
122
 
121
123
  # Run the version's block
122
- instance_eval &@@_versions[name][:block]
124
+ instance_eval _versions[name][:block]
123
125
 
124
126
  # Process if we were explicitly told to do so
125
127
  version_dst = process! if should_process
@@ -132,7 +134,7 @@ module Vips
132
134
  end
133
135
 
134
136
  # Get all the version keys
135
- def versions; @@_versions.keys; end
137
+ def versions; class_variable_get(:@@_versions).keys; end
136
138
  end
137
139
  end
138
140
  end
@@ -31,6 +31,19 @@ test "it should define a version" do
31
31
  assert image.respond_to?(:blurred_version)
32
32
  end
33
33
 
34
+ test "it should keep the versions within the class they were defined" do
35
+ class Image1 < Vips::Process::Base
36
+ version(:v1) { 'v1' }
37
+ end
38
+
39
+ class Image2 < Vips::Process::Base
40
+ version(:v2) { 'v2' }
41
+ end
42
+
43
+ assert_equal Image1.versions, [:v1]
44
+ assert_equal Image2.versions, [:v2]
45
+ end
46
+
34
47
  test "it should allow a version to be composed out of other versions" do print 'S' end
35
48
  test "it should allow a version to be composed out of other versions and have a block" do print 'S' end
36
49
  test "it should reset the settings after process! runs" do print 'S' end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vips-process
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darío Javier Cravero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-02 00:00:00.000000000 Z
11
+ date: 2014-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-vips