Class: CSVPlusPlus::Language::Entities::Function
- Inherits:
-
EntityWithArguments
- Object
- Entity
- EntityWithArguments
- CSVPlusPlus::Language::Entities::Function
- Defined in:
- lib/csv_plus_plus/language/entities/function.rb
Overview
A function definition
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
Attributes inherited from EntityWithArguments
Attributes inherited from Entity
Instance Method Summary collapse
-
#==(other) ⇒ Object
.
-
#initialize(id, arguments, body) ⇒ Function
constructor
Create a function.
-
#to_s ⇒ Object
to_s.
Methods inherited from Entity
#method_missing, #respond_to_missing?
Constructor Details
#initialize(id, arguments, body) ⇒ Function
Create a function
16 17 18 19 |
# File 'lib/csv_plus_plus/language/entities/function.rb', line 16 def initialize(id, arguments, body) super(:function, id:, arguments: arguments.map(&:to_sym)) @body = body end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CSVPlusPlus::Language::Entities::Entity
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
10 11 12 |
# File 'lib/csv_plus_plus/language/entities/function.rb', line 10 def body @body end |
Instance Method Details
#==(other) ⇒ Object
27 28 29 |
# File 'lib/csv_plus_plus/language/entities/function.rb', line 27 def ==(other) super && @body == other.body end |
#to_s ⇒ Object
to_s
22 23 24 |
# File 'lib/csv_plus_plus/language/entities/function.rb', line 22 def to_s "def #{@id.to_s.upcase}(#{arguments_to_s}) #{@body}" end |