Class: Simplabs::Excellent::Parsing::CallContext

Inherits:
SexpContext
  • Object
show all
Includes:
Comparable
Defined in:
lib/simplabs/excellent/parsing/call_context.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Attributes inherited from SexpContext

#file, #line, #name, #parent

Instance Method Summary collapse

Methods inherited from SexpContext

#full_name, #method_missing

Constructor Details

#initialize(exp, parent) ⇒ CallContext

Returns a new instance of CallContext.



14
15
16
17
18
19
20
21
# File 'lib/simplabs/excellent/parsing/call_context.rb', line 14

def initialize(exp, parent)
  super
  @receiver  = exp[1].is_a?(Sexp) ? (exp[1][1].nil? ? exp[1][2].to_s : exp[1][1].to_s) : nil
  @method    = exp[2].to_s
  @full_name = [@receiver, @method].compact.join('.')
  record_validation
  record_call
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Simplabs::Excellent::Parsing::SexpContext

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



12
13
14
# File 'lib/simplabs/excellent/parsing/call_context.rb', line 12

def method
  @method
end

#receiverObject (readonly)

Returns the value of attribute receiver.



11
12
13
# File 'lib/simplabs/excellent/parsing/call_context.rb', line 11

def receiver
  @receiver
end

Instance Method Details

#<=>(other) ⇒ Object Also known as: eql?



23
24
25
# File 'lib/simplabs/excellent/parsing/call_context.rb', line 23

def <=>(other)
  @full_name <=> other.full_name
end

#hashObject



28
29
30
# File 'lib/simplabs/excellent/parsing/call_context.rb', line 28

def hash
  @full_name.hash
end