class ROM::LDAP::Schema::AttributesInferrer
@api private
Public Instance Methods
call(schema, gateway)
click to toggle source
@api private
# File lib/rom/ldap/schema/attributes_inferrer.rb, line 18 def call(schema, gateway) dataset = schema.name.dataset columns = dataset_attributes(gateway, dataset) inferred = columns.map do |name| type = type_builder.call(name, schema.name) attr_class.new(type, name: name.to_sym) end missing = columns - inferred.map { |attr| attr.meta[:name] } [inferred, missing] end
with(new_options)
click to toggle source
@api private
# File lib/rom/ldap/schema/attributes_inferrer.rb, line 33 def with(new_options) self.class.new(options.merge(new_options)) end
Private Instance Methods
dataset_attributes(gateway, dataset)
click to toggle source
All possible formatted Entry attribute names.
@see Directory#query_attributes
@param dataset [String] LDAP
filter string / dataset name @param gateway [ROM::LDAP::Gateway]
@return [Array<Symbol, String>]
@example => [:cn, :dn, :given_name, :mail, :object_class, :sn]
@api private
# File lib/rom/ldap/schema/attributes_inferrer.rb, line 51 def dataset_attributes(gateway, dataset) gateway[dataset].flat_map(&:keys).uniq.sort end