compositor 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/compositor/leaf.rb +1 -1
- data/lib/compositor/version.rb +1 -1
- data/spec/compositor/leaf_spec.rb +10 -0
- data/spec/support/sample_dsl.rb +6 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c53b568af58b64887c5f17fdcb03e12d0a6ca80
|
4
|
+
data.tar.gz: 00eb3ec599013b9b412c69ac522c57737aea2fde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cce15dd0a544692b5763d38a568c2126ea4ff9ae8d5019de244dbacd24f9b713124cd4bbc4542dd5d86ca7378f710ef0b3c47c382bb73525ba5592e10f78ac1a
|
7
|
+
data.tar.gz: 222782f040a41c9aa9101597e24f719b6865a3b71c6a1c87ad8efe0df3f41d4db93c607dc031a9337e2624c0c900036c1fac20074f17fedc73bff1e1c35b1acc
|
data/lib/compositor/leaf.rb
CHANGED
data/lib/compositor/version.rb
CHANGED
@@ -26,6 +26,16 @@ describe Compositor::Leaf do
|
|
26
26
|
{a: "b"}.should == dsl.to_hash
|
27
27
|
end
|
28
28
|
|
29
|
+
describe 'when root is true' do
|
30
|
+
it 'returns full root' do
|
31
|
+
dsl = Compositor::DSL.create(context) do |dsl|
|
32
|
+
dsl.dsl_string root: true
|
33
|
+
end
|
34
|
+
|
35
|
+
{ dsl_string: { a: "b" } }.should == dsl.to_hash
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
29
39
|
it "returns an instance of subclass" do
|
30
40
|
dsl = Compositor::DSL.create(context).dsl_string
|
31
41
|
dsl.should be_kind_of(DslStringCompositor)
|
data/spec/support/sample_dsl.rb
CHANGED
@@ -2,9 +2,11 @@ class DslStringCompositor < Compositor::Leaf
|
|
2
2
|
attr_accessor :string
|
3
3
|
|
4
4
|
def to_hash
|
5
|
-
|
5
|
+
with_root_element do
|
6
|
+
{
|
6
7
|
a: "b"
|
7
|
-
|
8
|
+
}
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
@@ -18,7 +20,7 @@ class DslIntCompositor < Compositor::Leaf
|
|
18
20
|
def to_hash
|
19
21
|
with_root_element do
|
20
22
|
{
|
21
|
-
|
23
|
+
number: @number
|
22
24
|
}
|
23
25
|
end
|
24
26
|
end
|
@@ -29,7 +31,7 @@ class DslObjectCompositor < Compositor::Leaf
|
|
29
31
|
|
30
32
|
def to_hash
|
31
33
|
{
|
32
|
-
|
34
|
+
a: object
|
33
35
|
}
|
34
36
|
end
|
35
37
|
end
|