Module: CSVPlusPlus::Entities::ASTBuilder
Overview
Some helpful functions that can be mixed into a class to help building ASTs
Instance Method Summary collapse
-
#method_missing(method_name, *args, **kwargs, &block) ⇒ Entity, #super
Let the current class have functions which can build a given entity by calling it’s type.
-
#respond_to_missing?(method_name, *_args) ⇒ ::T::Boolean, #super
Let the current class have functions which can build a given entity by calling it’s type.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, **kwargs, &block) ⇒ 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)
rubocop:disable Naming/BlockForwarding
27 28 29 30 31 |
# File 'lib/csv_plus_plus/entities/ast_builder.rb', line 27 def method_missing(method_name, *args, **kwargs, &block) ::CSVPlusPlus::Entities.const_get(snake_case_to_class_name(method_name)).new(*args, **kwargs, &block) rescue ::NameError super end |
Instance Method Details
#respond_to_missing?(method_name, *_args) ⇒ ::T::Boolean, #super
Let the current class have functions which can build a given entity by calling it’s type. For example number(1), variable(:foo)
42 43 44 45 46 47 |
# File 'lib/csv_plus_plus/entities/ast_builder.rb', line 42 def respond_to_missing?(method_name, *_args) ::CSVPlusPlus::Entities.const_get(snake_case_to_class_name(method_name)) true rescue ::NameError super end |