class ROM::LDAP::DSL
@api private
Attributes
picked_relations[R]
@!attribute [r] picked_relations
@return [Concurrent::Map]
relations[R]
@!attribute [r] relations
@return [Hash, RelationRegistry]
schema[R]
@!attribute [r] schema
@return [LDAP::Schema]
Public Class Methods
new(schema)
click to toggle source
@api private
# File lib/rom/ldap/dsl.rb, line 26 def initialize(schema) @schema = schema @relations = schema.respond_to?(:relations) ? schema.relations : EMPTY_HASH @picked_relations = ::Concurrent::Map.new end
Public Instance Methods
call(&block)
click to toggle source
@api private
# File lib/rom/ldap/dsl.rb, line 33 def call(&block) result = instance_exec(select_relations(block.parameters), &block) if result.is_a?(::Array) result else [result] end end
respond_to_missing?(name, include_private = false)
click to toggle source
@api private
Calls superclass method
# File lib/rom/ldap/dsl.rb, line 44 def respond_to_missing?(name, include_private = false) super || schema.key?(name) end
Private Instance Methods
select_relations(parameters)
click to toggle source
@api private
# File lib/rom/ldap/dsl.rb, line 62 def select_relations(parameters) @picked_relations.fetch_or_store(parameters.hash) do keys = parameters.select { |type, _| type == :keyreq } if keys.empty? relations else keys.each_with_object({}) { |(_, k), rs| rs[k] = relations[k] } end end end
type(identifier)
click to toggle source
@api private
# File lib/rom/ldap/dsl.rb, line 51 def type(identifier) type_name = Inflector.classify(identifier) types.const_get(type_name) if types.const_defined?(type_name) end
types()
click to toggle source
@api private
# File lib/rom/ldap/dsl.rb, line 57 def types ::ROM::LDAP::Types end