Class: CSVPlusPlus::Entities::FunctionCall
- Inherits:
-
EntityWithArguments
- Object
- Entity
- EntityWithArguments
- CSVPlusPlus::Entities::FunctionCall
- Defined in:
- lib/csv_plus_plus/entities/function_call.rb
Overview
A function call
Instance Attribute Summary collapse
-
#infix ⇒ boolean
readonly
Whether or not this function call is infix (X * Y, A + B, etc).
Attributes inherited from EntityWithArguments
Attributes inherited from Entity
Instance Method Summary collapse
- #==(other) ⇒ boolean
-
#initialize(id, arguments, infix: false) ⇒ FunctionCall
constructor
A new instance of FunctionCall.
- #to_s ⇒ String
Methods inherited from Entity
#method_missing, #respond_to_missing?
Constructor Details
#initialize(id, arguments, infix: false) ⇒ FunctionCall
Returns a new instance of FunctionCall.
14 15 16 17 18 |
# File 'lib/csv_plus_plus/entities/function_call.rb', line 14 def initialize(id, arguments, infix: false) super(:function_call, id:, arguments:) @infix = infix end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CSVPlusPlus::Entities::Entity
Instance Attribute Details
#infix ⇒ boolean (readonly)
Whether or not this function call is infix (X * Y, A + B, etc)
8 9 10 |
# File 'lib/csv_plus_plus/entities/function_call.rb', line 8 def infix @infix end |
Instance Method Details
#==(other) ⇒ boolean
30 31 32 |
# File 'lib/csv_plus_plus/entities/function_call.rb', line 30 def ==(other) super && @id == other.id end |
#to_s ⇒ String
21 22 23 24 25 26 27 |
# File 'lib/csv_plus_plus/entities/function_call.rb', line 21 def to_s if @infix "(#{arguments.join(" #{@id} ")})" else "#{@id.to_s.upcase}(#{arguments_to_s})" end end |