contextuality 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -0
- data/lib/contextuality.rb +2 -1
- data/lib/contextuality/defaults.rb +12 -0
- data/lib/contextuality/version.rb +1 -1
- data/spec/contextuality_spec.rb +18 -0
- metadata +2 -1
data/README.md
CHANGED
data/lib/contextuality.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "contextuality/version"
|
2
|
+
require "contextuality/defaults"
|
2
3
|
require "contextuality/context"
|
3
4
|
|
4
5
|
module Contextuality
|
@@ -14,7 +15,7 @@ module Contextuality
|
|
14
15
|
end
|
15
16
|
|
16
17
|
def self.defaults
|
17
|
-
::Thread.main[:contextuality_defaults] ||=
|
18
|
+
::Thread.main[:contextuality_defaults] ||= Contextuality::Defaults.new
|
18
19
|
end
|
19
20
|
|
20
21
|
module ContextualityMethods
|
data/spec/contextuality_spec.rb
CHANGED
@@ -107,4 +107,22 @@ describe Contextuality do
|
|
107
107
|
end
|
108
108
|
end
|
109
109
|
end
|
110
|
+
|
111
|
+
context 'defaults lambda' do
|
112
|
+
before { Contextuality.defaults[:bar] = ->{ 'Foo' } }
|
113
|
+
|
114
|
+
specify { Contextuality.bar.should == 'Foo' }
|
115
|
+
|
116
|
+
specify do
|
117
|
+
contextualize do
|
118
|
+
Contextuality.bar.should == 'Foo'
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
specify do
|
123
|
+
contextualize(bar: 'Hello') do
|
124
|
+
Contextuality.bar.should == 'Hello'
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
110
128
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contextuality
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -29,6 +29,7 @@ files:
|
|
29
29
|
- contextuality.gemspec
|
30
30
|
- lib/contextuality.rb
|
31
31
|
- lib/contextuality/context.rb
|
32
|
+
- lib/contextuality/defaults.rb
|
32
33
|
- lib/contextuality/version.rb
|
33
34
|
- spec/contextuality/context_spec.rb
|
34
35
|
- spec/contextuality_spec.rb
|