sugar-high 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +11 -1
- data/VERSION +1 -1
- data/lib/sugar-high/dsl.rb +2 -2
- data/spec/sugar-high/dsl_spec.rb +21 -0
- data/sugar-high.gemspec +1 -1
- metadata +14 -14
data/README.textile
CHANGED
@@ -84,7 +84,9 @@ Note: This pack has recently been extracted into its own gem called *sweet_loade
|
|
84
84
|
|
85
85
|
h3. DSL
|
86
86
|
|
87
|
-
|
87
|
+
by @stanislaw
|
88
|
+
|
89
|
+
* with(instance, *args &block)
|
88
90
|
|
89
91
|
Useful as a building block for DSLs!
|
90
92
|
|
@@ -93,6 +95,14 @@ with(Hash.new) do
|
|
93
95
|
merge!(:a => 1)
|
94
96
|
merge!(:b => 2)
|
95
97
|
end.should == {:a => 1, :b => 2}
|
98
|
+
|
99
|
+
with(Hash.new, :ready => true) do |options|
|
100
|
+
...
|
101
|
+
end
|
102
|
+
|
103
|
+
with(Hash.new, 1,2,3) do |*args|
|
104
|
+
...
|
105
|
+
end
|
96
106
|
</pre>
|
97
107
|
|
98
108
|
h3. Enumerable
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.5
|
data/lib/sugar-high/dsl.rb
CHANGED
data/spec/sugar-high/dsl_spec.rb
CHANGED
@@ -10,6 +10,27 @@ describe "SugarHigh" do
|
|
10
10
|
merge!(:b => 2)
|
11
11
|
end.should == {:a => 1, :b => 2}
|
12
12
|
end
|
13
|
+
|
14
|
+
it "should allow calls on instance in block + pass *args to block" do
|
15
|
+
with(Hash.new, 1, 2, 3) do |*args|
|
16
|
+
merge!(:first => args.first)
|
17
|
+
merge!(:a => 1)
|
18
|
+
merge!(:b => 2)
|
19
|
+
end.should == {:a => 1, :b => 2, :first => 1}
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should allow calls on instance in block + pass options hash (variable) to block" do
|
23
|
+
options = {:session => 1, :request => 2, :params => 3}
|
24
|
+
with(Hash.new, options) do |options|
|
25
|
+
merge! options
|
26
|
+
end.should == {:session => 1, :request => 2, :params => 3}
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should allow calls on instance in block + pass options hash (explicitly) to block" do
|
30
|
+
with(Hash.new, :session => 1, :request => 2, :params => 3) do |options|
|
31
|
+
merge! options
|
32
|
+
end.should == {:session => 1, :request => 2, :params => 3}
|
33
|
+
end
|
13
34
|
end
|
14
35
|
end
|
15
36
|
end
|
data/sugar-high.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugar-high
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-08-19 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &2161732500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2161732500
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &2161732020 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.4.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2161732020
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rails
|
38
|
-
requirement: &
|
38
|
+
requirement: &2161731540 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 3.0.1
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2161731540
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &2161731060 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.6.4
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2161731060
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bundler
|
60
|
-
requirement: &
|
60
|
+
requirement: &2161730580 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.1
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2161730580
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rdoc
|
71
|
-
requirement: &
|
71
|
+
requirement: &2161730100 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2161730100
|
80
80
|
description: More Ruby sugar - inspired by the 'zuker' project
|
81
81
|
email: kmandrup@gmail.com
|
82
82
|
executables: []
|
@@ -195,7 +195,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
195
195
|
version: '0'
|
196
196
|
segments:
|
197
197
|
- 0
|
198
|
-
hash:
|
198
|
+
hash: 965949854900223012
|
199
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
200
|
none: false
|
201
201
|
requirements:
|