class Metamorpher::Builders::AST::GreedyVariableBuilder
Public Instance Methods
greedy_variable!(name, &block)
click to toggle source
# File lib/metamorpher/builders/ast/greedy_variable_builder.rb, line 7 def greedy_variable!(name, &block) if block Terms::Variable.new(name: name, greedy?: true, condition: block) else Terms::Variable.new(name: name, greedy?: true) end end
method_missing(method, *arguments, &block)
click to toggle source
Calls superclass method
# File lib/metamorpher/builders/ast/greedy_variable_builder.rb, line 19 def method_missing(method, *arguments, &block) if shorthand?(method, *arguments, &block) greedy_variable!(method.to_s.chomp("_").downcase.to_sym, *arguments, &block) else super.method_missing(method, *arguments, &block) end end
shorthand?(method, *_arguments, &_block)
click to toggle source
# File lib/metamorpher/builders/ast/greedy_variable_builder.rb, line 15 def shorthand?(method, *_arguments, &_block) !method[/\p{Lower}/] && method.to_s.end_with?("_") end