Class: V8::NamedPropertyGetter

Inherits:
Object
  • Object
show all
Defined in:
lib/v8/access.rb

Class Method Summary collapse

Class Method Details

.call(property, info) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/v8/access.rb', line 94

def self.call(property, info)
  name = To.rb(property)
  obj = To.rb(info.This())
  perl_name = To.perl_case(name)
  methods = obj.public_methods(false).map {|m| m.to_s}
  method_name = if methods.include?(name)
    name
  elsif methods.include?(perl_name)
    perl_name
  end
  if method_name
    method = obj.method(method_name)
    if method.arity == 0
      Function.rubycall(method)
    else
      To.v8(method)
    end
  else
    C::Empty
  end
end