curlybars 1.5.0 → 1.5.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 +4 -4
 - data/lib/curlybars/version.rb +1 -1
 - data/lib/curlybars/visitor.rb +6 -0
 - data/spec/integration/visitor_spec.rb +13 -5
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 307c759c2acc1c33ab91a236aeb5042e6ecfee67581eef05f468c241a722e1f6
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 68b0a401f830e5985d0d6b657974f84c2afdda2d49e70c696e97641845d31a16
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 7db835baca28f2c15af2fb1a582059bb8346d1de41f8d9ed72262ea7ef1e2ff2e8130091b4e1494858b366f050e1b2fe2cf1753afbd1a403c66058c37f8fa9ff
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9a54e30bba2976a6c6f0ff4e6fef5f00075dc6186a9eb07c70a63ead7a96629a17897ce9ea9e09fad00049262a891eb88b1389873b629ca22f12c7b712686166
         
     | 
    
        data/lib/curlybars/version.rb
    CHANGED
    
    
    
        data/lib/curlybars/visitor.rb
    CHANGED
    
    | 
         @@ -75,6 +75,12 @@ module Curlybars 
     | 
|
| 
       75 
75 
     | 
    
         
             
                def visit_string(_node)
         
     | 
| 
       76 
76 
     | 
    
         
             
                end
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
      
 78 
     | 
    
         
            +
                def visit_sub_expression(node)
         
     | 
| 
      
 79 
     | 
    
         
            +
                  visit(node.helper)
         
     | 
| 
      
 80 
     | 
    
         
            +
                  node.arguments.each { |argument| visit(argument) }
         
     | 
| 
      
 81 
     | 
    
         
            +
                  node.options.each { |option| visit(option) }
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
       78 
84 
     | 
    
         
             
                def visit_template(node)
         
     | 
| 
       79 
85 
     | 
    
         
             
                  node.items.each { |item| visit(item) }
         
     | 
| 
       80 
86 
     | 
    
         
             
                end
         
     | 
| 
         @@ -4,6 +4,8 @@ describe "visitor" do 
     | 
|
| 
       4 
4 
     | 
    
         
             
                  {{#print_args_and_options 'first' 'second' key='value'}}
         
     | 
| 
       5 
5 
     | 
    
         
             
                  {{/print_args_and_options}}
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
      
 7 
     | 
    
         
            +
                  {{calc (calc 1 "+" 2) "*" 3}}
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       7 
9 
     | 
    
         
             
                  {{#render_inverse}}
         
     | 
| 
       8 
10 
     | 
    
         
             
                    fn
         
     | 
| 
       9 
11 
     | 
    
         
             
                  {{else}}
         
     | 
| 
         @@ -53,7 +55,7 @@ describe "visitor" do 
     | 
|
| 
       53 
55 
     | 
    
         
             
                it "visits BlockHelperElse nodes" do
         
     | 
| 
       54 
56 
     | 
    
         
             
                  visitor = counting_visitor_for(Curlybars::Node::BlockHelperElse)
         
     | 
| 
       55 
57 
     | 
    
         
             
                  output = Curlybars.visit(visitor, source)
         
     | 
| 
       56 
     | 
    
         
            -
                  expect(output).to eq( 
     | 
| 
      
 58 
     | 
    
         
            +
                  expect(output).to eq(5)
         
     | 
| 
       57 
59 
     | 
    
         
             
                end
         
     | 
| 
       58 
60 
     | 
    
         | 
| 
       59 
61 
     | 
    
         
             
                it "visits EachElse nodes" do
         
     | 
| 
         @@ -71,13 +73,13 @@ describe "visitor" do 
     | 
|
| 
       71 
73 
     | 
    
         
             
                it "visits Item nodes" do
         
     | 
| 
       72 
74 
     | 
    
         
             
                  visitor = counting_visitor_for(Curlybars::Node::Item)
         
     | 
| 
       73 
75 
     | 
    
         
             
                  output = Curlybars.visit(visitor, source)
         
     | 
| 
       74 
     | 
    
         
            -
                  expect(output).to eq( 
     | 
| 
      
 76 
     | 
    
         
            +
                  expect(output).to eq(44)
         
     | 
| 
       75 
77 
     | 
    
         
             
                end
         
     | 
| 
       76 
78 
     | 
    
         | 
| 
       77 
79 
     | 
    
         
             
                it "visits Literal nodes" do
         
     | 
| 
       78 
80 
     | 
    
         
             
                  visitor = counting_visitor_for(Curlybars::Node::Literal)
         
     | 
| 
       79 
81 
     | 
    
         
             
                  output = Curlybars.visit(visitor, source)
         
     | 
| 
       80 
     | 
    
         
            -
                  expect(output).to eq( 
     | 
| 
      
 82 
     | 
    
         
            +
                  expect(output).to eq(8)
         
     | 
| 
       81 
83 
     | 
    
         
             
                end
         
     | 
| 
       82 
84 
     | 
    
         | 
| 
       83 
85 
     | 
    
         
             
                it "visits Option nodes" do
         
     | 
| 
         @@ -95,7 +97,7 @@ describe "visitor" do 
     | 
|
| 
       95 
97 
     | 
    
         
             
                it "visits Path nodes" do
         
     | 
| 
       96 
98 
     | 
    
         
             
                  visitor = counting_visitor_for(Curlybars::Node::Path)
         
     | 
| 
       97 
99 
     | 
    
         
             
                  output = Curlybars.visit(visitor, source)
         
     | 
| 
       98 
     | 
    
         
            -
                  expect(output).to eq( 
     | 
| 
      
 100 
     | 
    
         
            +
                  expect(output).to eq(15)
         
     | 
| 
       99 
101 
     | 
    
         
             
                end
         
     | 
| 
       100 
102 
     | 
    
         | 
| 
       101 
103 
     | 
    
         
             
                it "visits Root nodes" do
         
     | 
| 
         @@ -104,6 +106,12 @@ describe "visitor" do 
     | 
|
| 
       104 
106 
     | 
    
         
             
                  expect(output).to eq(1)
         
     | 
| 
       105 
107 
     | 
    
         
             
                end
         
     | 
| 
       106 
108 
     | 
    
         | 
| 
      
 109 
     | 
    
         
            +
                it "visits SubExpression nodes" do
         
     | 
| 
      
 110 
     | 
    
         
            +
                  visitor = counting_visitor_for(Curlybars::Node::SubExpression)
         
     | 
| 
      
 111 
     | 
    
         
            +
                  output = Curlybars.visit(visitor, source)
         
     | 
| 
      
 112 
     | 
    
         
            +
                  expect(output).to eq(1)
         
     | 
| 
      
 113 
     | 
    
         
            +
                end
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
       107 
115 
     | 
    
         
             
                it "visits Template nodes" do
         
     | 
| 
       108 
116 
     | 
    
         
             
                  visitor = counting_visitor_for(Curlybars::Node::Template)
         
     | 
| 
       109 
117 
     | 
    
         
             
                  output = Curlybars.visit(visitor, source)
         
     | 
| 
         @@ -113,7 +121,7 @@ describe "visitor" do 
     | 
|
| 
       113 
121 
     | 
    
         
             
                it "visits Text nodes" do
         
     | 
| 
       114 
122 
     | 
    
         
             
                  visitor = counting_visitor_for(Curlybars::Node::Text)
         
     | 
| 
       115 
123 
     | 
    
         
             
                  output = Curlybars.visit(visitor, source)
         
     | 
| 
       116 
     | 
    
         
            -
                  expect(output).to eq( 
     | 
| 
      
 124 
     | 
    
         
            +
                  expect(output).to eq(29)
         
     | 
| 
       117 
125 
     | 
    
         
             
                end
         
     | 
| 
       118 
126 
     | 
    
         | 
| 
       119 
127 
     | 
    
         
             
                it "visits UnlessElse nodes" do
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: curlybars
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.5.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Libo Cannici
         
     | 
| 
         @@ -14,7 +14,7 @@ authors: 
     | 
|
| 
       14 
14 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
     | 
    
         
            -
            date: 2020- 
     | 
| 
      
 17 
     | 
    
         
            +
            date: 2020-11-02 00:00:00.000000000 Z
         
     | 
| 
       18 
18 
     | 
    
         
             
            dependencies:
         
     | 
| 
       19 
19 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       20 
20 
     | 
    
         
             
              name: actionpack
         
     |