class Metamorpher::Builders::AST::VariableBuilder
Public Instance Methods
method_missing(method, *arguments, &block)
click to toggle source
Calls superclass method
# File lib/metamorpher/builders/ast/variable_builder.rb, line 19 def method_missing(method, *arguments, &block) if shorthand?(method, *arguments, &block) variable!(method.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/variable_builder.rb, line 15 def shorthand?(method, *_arguments, &_block) !method[/\p{Lower}/] && !method.to_s.end_with?("_") end
variable!(name, &block)
click to toggle source
# File lib/metamorpher/builders/ast/variable_builder.rb, line 7 def variable!(name, &block) if block Terms::Variable.new(name: name, condition: block) else Terms::Variable.new(name: name) end end