Class: Code::Node::LeftOperation::Operator

Inherits:
Code::Node show all
Defined in:
lib/code/node/left_operation.rb

Constant Summary collapse

DOT =
"."
COLON_COLON =
"::"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Code::Node

#evaluate, #resolve

Constructor Details

#initialize(parsed) ⇒ Operator

Returns a new instance of Operator.



12
13
14
15
16
17
# File 'lib/code/node/left_operation.rb', line 12

def initialize(parsed)
  return if parsed.blank?

  @operator = parsed.delete(:operator).presence
  @statement = Statement.new(parsed.delete(:statement).presence)
end

Instance Attribute Details

#operatorObject (readonly)

Returns the value of attribute operator.



10
11
12
# File 'lib/code/node/left_operation.rb', line 10

def operator
  @operator
end

#statementObject (readonly)

Returns the value of attribute statement.



10
11
12
# File 'lib/code/node/left_operation.rb', line 10

def statement
  @statement
end

Instance Method Details

#call?Boolean

Returns:



19
20
21
# File 'lib/code/node/left_operation.rb', line 19

def call?
  operator == DOT || operator == COLON_COLON
end