node_mutation 1.15.3 → 1.16.0
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/node_mutation/parser_adapter.rb +18 -0
- data/lib/node_mutation/version.rb +1 -1
- 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: 14e76d23c3a0be62554de359db928e7f0e70fe75b6c13ecb0655add5af735333
         | 
| 4 | 
            +
              data.tar.gz: 1777be0d1e8c4044fa175dcc8f9f9e3431283fdf039392cba9f8fe4fd656c676
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ef64c7156966a2d80c4bf823e0c3330d8934cf52306a9f179bac7105b52c82e78bb9b0d958510165a541fd1fe550b3eec7c7e78eaf3aa7f3207a5b0df1f9e4e3
         | 
| 7 | 
            +
              data.tar.gz: 969399df03dc8e3f5c15e55f37a3664bf0945a41e5ff244542319b8a2c20d6afff54dc3aee72b6b4e6c90c6ce84428b6008d14d3dc81e343c68296e78b387218
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
| @@ -120,6 +120,15 @@ class NodeMutation::ParserAdapter < NodeMutation::Adapter | |
| 120 120 | 
             
                    return NodeMutation::Struct::Range.new(pair_node.loc.expression.begin_pos, pair_node.loc.expression.end_pos)
         | 
| 121 121 | 
             
                  end
         | 
| 122 122 |  | 
| 123 | 
            +
                  if node.type == :hash && child_name.to_s.end_with?('_value')
         | 
| 124 | 
            +
                    pair_node = node.pairs.find { |pair| pair.key.to_value.to_s == child_name.to_s[0..-7] }
         | 
| 125 | 
            +
                    raise NodeMutation::MethodNotSupported,
         | 
| 126 | 
            +
                          "#{direct_child_name} is not supported for #{get_source(node)}" unless pair_node
         | 
| 127 | 
            +
                    return child_node_range(pair.value, nested_child_name) if nested_child_name
         | 
| 128 | 
            +
             | 
| 129 | 
            +
                    return NodeMutation::Struct::Range.new(pair_node.value.loc.expression.begin_pos, pair_node.value.loc.expression.end_pos)
         | 
| 130 | 
            +
                  end
         | 
| 131 | 
            +
             | 
| 123 132 | 
             
                  raise NodeMutation::MethodNotSupported,
         | 
| 124 133 | 
             
                        "#{direct_child_name} is not supported for #{get_source(node)}" unless node.respond_to?(direct_child_name)
         | 
| 125 134 |  | 
| @@ -206,6 +215,15 @@ class NodeMutation::ParserAdapter < NodeMutation::Adapter | |
| 206 215 | 
             
                  return pair_node
         | 
| 207 216 | 
             
                end
         | 
| 208 217 |  | 
| 218 | 
            +
                if node.is_a?(Parser::AST::Node) && node.type == :hash && direct_child_name.end_with?('_value')
         | 
| 219 | 
            +
                  pair_node = node.pairs.find { |pair| pair.key.to_value.to_s == direct_child_name[0..-7] }
         | 
| 220 | 
            +
                  raise NodeMutation::MethodNotSupported,
         | 
| 221 | 
            +
                        "#{direct_child_name} is not supported for #{get_source(node)}" unless pair_node
         | 
| 222 | 
            +
                  return child_node_by_name(pair_node.value, nested_child_name) if nested_child_name
         | 
| 223 | 
            +
             | 
| 224 | 
            +
                  return pair_node.value
         | 
| 225 | 
            +
                end
         | 
| 226 | 
            +
             | 
| 209 227 | 
             
                if node.respond_to?(direct_child_name)
         | 
| 210 228 | 
             
                  child_node = node.send(direct_child_name)
         | 
| 211 229 | 
             
                elsif direct_child_name.include?('(') && direct_child_name.include?(')')
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: node_mutation
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.16.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Richard Huang
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2023- | 
| 11 | 
            +
            date: 2023-05-10 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies: []
         | 
| 13 13 | 
             
            description: ast node mutation apis
         | 
| 14 14 | 
             
            email:
         |