Class: Fasterer::ReceiverFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/fasterer/method_call.rb

Overview

For now, used for determening if the receiver is a reference or not.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



90
91
92
# File 'lib/fasterer/method_call.rb', line 90

def method
  @method
end

#nameObject (readonly)

Returns the value of attribute name.



89
90
91
# File 'lib/fasterer/method_call.rb', line 89

def name
  @name
end

Class Method Details

.new(receiver_info) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/fasterer/method_call.rb', line 92

def self.new(receiver_info)
  return if receiver_info.nil?
  token = receiver_info.first

  case token
  when :lvar
    return VariableReference.new(receiver_info)
  when :method_add_arg, :method_add_block
    case receiver_info[1][0]
    when :call, :fcall
      return MethodCall.new(receiver_info[1])
    else
      # binding.pry watch out for :method_add_arg
      # raise 'nije ni metoda'
    end
  when :call, :iter
    return MethodCall.new(receiver_info)
  end
end