Class: LL::Operator

Inherits:
Object
  • Object
show all
Defined in:
lib/ll/operator.rb

Overview

Class for operators such as + and *.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, receiver, source_line) ⇒ Operator

Returns a new instance of Operator.

Parameters:



13
14
15
16
17
# File 'lib/ll/operator.rb', line 13

def initialize(type, receiver, source_line)
  @type        = type
  @receiver    = receiver
  @source_line = source_line
end

Instance Attribute Details

#receiverObject (readonly)

Returns the value of attribute receiver.



6
7
8
# File 'lib/ll/operator.rb', line 6

def receiver
  @receiver
end

#source_lineObject (readonly)

Returns the value of attribute source_line.



6
7
8
# File 'lib/ll/operator.rb', line 6

def source_line
  @source_line
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/ll/operator.rb', line 6

def type
  @type
end

Instance Method Details

#inspectString

Returns:

  • (String)


22
23
24
# File 'lib/ll/operator.rb', line 22

def inspect
  return "Operator(type: #{type.inspect}, receiver: #{receiver.inspect})"
end