Class: CSVPlusPlus::Entities::EntityWithArguments

Inherits:
Entity
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/csv_plus_plus/entities/entity_with_arguments.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

#evaluate

Constructor Details

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

Returns a new instance of EntityWithArguments.

Parameters:

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


28
29
30
31
# File 'lib/csv_plus_plus/entities/entity_with_arguments.rb', line 28

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

Instance Attribute Details

#argumentsArray<Entity>

The arguments supplied to this entity.

Returns:

  • (Array<Entity>)

    the current value of arguments



10
11
12
# File 'lib/csv_plus_plus/entities/entity_with_arguments.rb', line 10

def arguments
  @arguments
end

Instance Method Details

#==(other) ⇒ boolean

Parameters:

Returns:

  • (boolean)


37
38
39
40
41
# File 'lib/csv_plus_plus/entities/entity_with_arguments.rb', line 37

def ==(other)
  return false unless other.is_a?(self.class)

  @arguments == other.arguments && super
end