Sha256: 226cf7ef01912c5dd5f05b82c36ae5713bb61bfe45a6eca735e4221c90f92aa1

Contents?: true

Size: 604 Bytes

Versions: 1

Compression:

Stored size: 604 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motion-objection-0.6.2 lib/motion-objection/ruby_property_reflector.rb