Class: RubyPropertyReflector

Inherits:
Object
  • Object
show all
Defined in:
lib/motion-objection/ruby_property_reflector.rb

Constant Summary collapse

NAMESPACE_SEPARTOR =
"/"

Class Method Summary collapse

Class Method Details

.propertyForClass(klass, andProperty: property) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/motion-objection/ruby_property_reflector.rb', line 4

def self.propertyForClass(klass, andProperty: property)
  scopes = klass.send(:objectionTypeMappings)[property].to_s.split(NAMESPACE_SEPARTOR).map { |x| x.split("_") }.map { |x| x.map { |y| y.capitalize }.join("") }
  klass = scopes.inject(Object) do |const, name|
    const.const_get name
  end
  JSObjectionPropertyInfo.new(klass, JSObjectionTypeClass).value
end