Method: CSVPlusPlus::Language::ASTBuilder#method_missing

Defined in:
lib/csv_plus_plus/language/ast_builder.rb

#method_missing(method_name, *args, **kwargs) ⇒ Entity, #super

Let the current class have functions which can build a given entity by calling it's type. For example number(1), variable(:foo)

Parameters:

  • method_name (Symbol)

    The method_name to respond to

  • arguments

    [] The arguments to create the entity with

Returns:

  • (Entity, #super)


16
17
18
19
20
21
# File 'lib/csv_plus_plus/language/ast_builder.rb', line 16

def method_missing(method_name, *args, **kwargs, &)
  entity_class = ::CSVPlusPlus::Language::TYPES[method_name.to_sym]
  return super unless entity_class

  entity_class.new(*args, **kwargs, &)
end