Class: CSVPlusPlus::Entities::EntityWithArguments

Inherits:
Entity
  • Object
show all
Defined in:
lib/csv_plus_plus/entities/entity.rb

Overview

An entity that can take other entities as arguments. Current use cases for this are function calls and function definitions

Direct Known Subclasses

Function, FunctionCall

Instance Attribute Summary collapse

Attributes inherited from Entity

#id, #type

Instance Method Summary collapse

Methods inherited from Entity

#method_missing, #respond_to_missing?

Constructor Details

#initialize(type, id: nil, arguments: []) ⇒ EntityWithArguments

Returns a new instance of EntityWithArguments.

Parameters:

  • type (::String, Symbol)
  • id (::String) (defaults to: nil)
  • arguments (Array<Entity>) (defaults to: [])


65
66
67
68
# File 'lib/csv_plus_plus/entities/entity.rb', line 65

def initialize(type, id: nil, arguments: [])
  super(type, id:)
  @arguments = arguments
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CSVPlusPlus::Entities::Entity

Instance Attribute Details

#argumentsArray<Entity>

The arguments supplied to this entity.

Returns:

  • (Array<Entity>)

    the current value of arguments



59
60
61
# File 'lib/csv_plus_plus/entities/entity.rb', line 59

def arguments
  @arguments
end

Instance Method Details

#==(other) ⇒ boolean

Returns:

  • (boolean)


71
72
73
# File 'lib/csv_plus_plus/entities/entity.rb', line 71

def ==(other)
  super && @arguments == other.arguments
end