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

- (Operator) initialize(type, receiver, source_line)

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

- (Object) receiver (readonly)

Returns the value of attribute receiver



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

def receiver
  @receiver
end

- (Object) source_line (readonly)

Returns the value of attribute source_line



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

def source_line
  @source_line
end

- (Object) type (readonly)

Returns the value of attribute type



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

def type
  @type
end

Instance Method Details

- (String) inspect

Returns:

  • (String)


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

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