uber 0.0.3 → 0.0.4

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: ca88c9e957495cdf978405ff7c9c7f67d6d0258a
4
- data.tar.gz: 151fb75aea52f7485dd8eee7d86afac8b80b61ab
3
+ metadata.gz: 516c9e7445cdc09ca9cc33afce8ffbb32494d1c0
4
+ data.tar.gz: d9e02ab06a8282723242cd9486331a44f1c42ce1
5
5
  SHA512:
6
- metadata.gz: 4748f03b0f45606e62428bf2d14a7ad5ab22c29b68f887c012faafb738110d4279c0c818098ba5c3b2f7c531d65dab13710ff53ec50f13f8d00aa6a21cb36e85
7
- data.tar.gz: ce170857e5789abd29ea165be5aae4ee4ecb527d80de5224bf1a70c0c232461adade8483a6d1ad3af030c64a83eed1bb0c549aa57d56ebfeda5f768322be0f7b
6
+ metadata.gz: c517333088ac322d06847427c10694c6fbea60e20e74e433fb0f41f035478ea326c85169e6bf80572c81e6170684cb0b659ce5311a2ffc6476f09600913896d9
7
+ data.tar.gz: 4cb7b1e5069343dc6209794f01f23af9305bec11a4d8dad6be89f3ab18e62793edf78272b56ab655a1ac1dbfb5fea7905aaf5ecc5ef8bbf0133ab1ed0d1037e3
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.0.4
2
+
3
+ * Fix a bug where `dynamic: true` wouldn't invoke a method but try to run it as a block.
4
+
1
5
  # 0.0.3
2
6
 
3
7
  * Add `Options` and `Options::Value´ for abstracting dynamic options.
@@ -41,13 +41,15 @@ module Uber
41
41
 
42
42
  class Value # TODO: rename to Value.
43
43
  def initialize(value, options={})
44
- @value, @options = value, options
44
+ @value, @dynamic = value, options[:dynamic]
45
45
 
46
- return if @options.has_key?(:dynamic)
46
+ @callable = true if @value.kind_of?(Proc)
47
+
48
+ return if options.has_key?(:dynamic)
47
49
 
48
50
  # conventional behaviour:
49
- @callable = @options[:dynamic] = true if @value.kind_of?(Proc)
50
- @options[:dynamic] = true if @value.is_a?(Symbol)
51
+ @dynamic = true if @callable
52
+ @dynamic = true if @value.is_a?(Symbol)
51
53
  end
52
54
 
53
55
  def evaluate(context, *args)
@@ -57,7 +59,7 @@ module Uber
57
59
  end
58
60
 
59
61
  def dynamic?
60
- @options[:dynamic]
62
+ @dynamic
61
63
  end
62
64
 
63
65
  private
@@ -1,3 +1,3 @@
1
1
  module Uber
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -10,6 +10,7 @@ class UberOptionTest < MiniTest::Spec
10
10
  it { Value.new(true).dynamic?.must_equal nil }
11
11
  it { Value.new("loud").dynamic?.must_equal nil }
12
12
  it { Value.new(:loud, :dynamic => false).dynamic?.must_equal false }
13
+ it { Value.new("loud", :dynamic => true).dynamic?.must_equal true }
13
14
 
14
15
  it { Value.new(lambda {}).dynamic?.must_equal true }
15
16
  it { Value.new(Proc.new{}).dynamic?.must_equal true }
@@ -27,6 +28,8 @@ class UberOptionTest < MiniTest::Spec
27
28
  it { Value.new(:version).evaluate(object.extend(version)).must_equal 999 }
28
29
  it { Value.new("version", :dynamic => true).evaluate(object.extend(version)).must_equal 999 }
29
30
  it { Value.new(:version, :dynamic => false).evaluate(object.extend(version)).must_equal :version }
31
+
32
+ it { Value.new(lambda { :loud }, :dynamic => true).evaluate(object).must_equal :loud }
30
33
  end
31
34
 
32
35
  describe "passing options" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer