Method: AbstractMapper::AST::Branch.update

Defined in:
lib/abstract_mapper/ast/branch.rb

.update { ... } ⇒ AbstractMapper::Branch

Returns a new branch of the same type, with the same attributes, but with a different collection of subnodes, transmitted by the block.

Examples:

branch = Branch.new(:foo)
# => <Branch(:foo) []>
branch.update { AST::Node.new(:bar) }
# => <Branch(:foo) [<AST::Node(:bar)>]>

Yields:

  • block

Returns:

  • (AbstractMapper::Branch)


55
56
57
# File 'lib/abstract_mapper/ast/branch.rb', line 55

def update
  self.class.new(attributes) { yield }
end