class ROM::LDAP::Attribute

Extended schema attributes tailored for LDAP directories

@api public

Public Class Methods

[](*args) click to toggle source

@param args [Mixed]

@return [ROM::LDAP::Attribute]

@api public

# File lib/rom/ldap/attribute.rb, line 20
def self.[](*args)
  fetch_or_store(args) { new(*args) }
end

Public Instance Methods

!=(value)
Alias for: not
!~(value)
Alias for: not_like
<(value)
Alias for: lt
<=(value)
Alias for: lte
==(value)
Alias for: is
===(value)
Alias for: bitwise
=~(value)
Alias for: like
>(value)
Alias for: gt
>=(value)
Alias for: gte
bitwise(value) click to toggle source

@param value [Mixed]

@return [Array]

@api public

# File lib/rom/ldap/attribute.rb, line 318
def bitwise(value)
  [:op_eql, name, value]
end
Also aliased as: ===
canonical() click to toggle source

Return a new attribute in its canonical form

@see Dataset#export

@return [LDAP::Attribute]

@api public

# File lib/rom/ldap/attribute.rb, line 158
def canonical
  if aliased?
    meta(alias: nil)
  else
    self
  end
end
definition() click to toggle source

Raw LDAP Attribute Definition.

@return [String]

@api public

# File lib/rom/ldap/attribute.rb, line 102
def definition
  meta[:definition]
end
description() click to toggle source

OID description

@return [String]

@api public

# File lib/rom/ldap/attribute.rb, line 120
def description
  meta[:description]
end
editable?() click to toggle source

Attribute definition identifies this is not a directory internal attribute and values can be altered.

@return [Boolean]

@api public

# File lib/rom/ldap/attribute.rb, line 30
def editable?
  meta[:editable].equal?(true)
end
exists() click to toggle source

@example

users.where { given_name.exists }
users.where { ~given_name }

@return [Array]

@api public

# File lib/rom/ldap/attribute.rb, line 173
def exists
  [:op_eql, name, :wildcard]
end
Also aliased as: ~@
extensible(value) click to toggle source

@param value [Mixed]

@see ldapwiki.com/wiki/ExtensibleMatch

@return [Array]

@api public

# File lib/rom/ldap/attribute.rb, line 309
def extensible(value)
  [:op_ext, name, value]
end
foreign_key() click to toggle source

Return a new attribute marked as a FK

@return [LDAP::Attribute]

@api public

# File lib/rom/ldap/attribute.rb, line 84
def foreign_key
  meta(foreign_key: true)
end
gt(value) click to toggle source

@param value [Mixed]

@example

users.where { uid_number.gt(101) }
users.where { uid_number > 101 }

@return [Array]

@api public

# File lib/rom/ldap/attribute.rb, line 227
def gt(value)
  [:con_not, lte(value)]
end
Also aliased as: >
gte(value) click to toggle source

@param value [Mixed]

@example

users.where { uid_number.gte(101) }
users.where { uid_number >= 101 }

@return [Array]

@api public

# File lib/rom/ldap/attribute.rb, line 255
def gte(value)
  [:op_gte, name, value]
end
Also aliased as: >=
indexed() click to toggle source

Returns a new attribute marked as indexed

@return [LDAP::Attribute]

@api public

# File lib/rom/ldap/attribute.rb, line 147
def indexed
  meta(index: true)
end
indexed?() click to toggle source

@return [Boolean]

@api public

# File lib/rom/ldap/attribute.rb, line 138
def indexed?
  meta[:index].equal?(true)
end
is(value) click to toggle source

@param value [Mixed]

@example

users.where { id.is(1) }
users.where { id == 1 }

users.where(users[:id].is(1))

@return [Array]

@api public

# File lib/rom/ldap/attribute.rb, line 199
def is(value)
  [:op_eql, name, value]
end
Also aliased as: ==
joined() click to toggle source

Return a new attribute marked as joined

Whenever you join two schemas, the right schema's attribute will be marked as joined using this method

@return [LDAP::Attribute] Original attribute marked as joined

@api public

# File lib/rom/ldap/attribute.rb, line 60
def joined
  meta(joined: true)
end
joined?() click to toggle source

Return if an attribute was used in a join

@example

schema = users.schema.join(tasks.schema)

schema[:id, :tasks].joined?
# => true

@return [Boolean]

@api public

# File lib/rom/ldap/attribute.rb, line 75
def joined?
  meta[:joined].equal?(true)
end
like(value) click to toggle source

@param value [Mixed]

@example

users.where { given_name.like('peter') }
users.where { given_name =~ 'peter' }

@return [Array]

@api public

# File lib/rom/ldap/attribute.rb, line 283
def like(value)
  [:op_prx, name, value]
end
Also aliased as: =~
lt(value) click to toggle source

@param value [Mixed]

@example

users.where { uid_number.lt(101) }
users.where { uid_number < 101 }

@return [Array]

@api public

# File lib/rom/ldap/attribute.rb, line 241
def lt(value)
  [:con_not, gte(value)]
end
Also aliased as: <
lte(value) click to toggle source

@param value [Mixed]

@example

users.where { uid_number.lte(101) }
users.where { uid_number <= 101 }

@return [Array]

@api public

# File lib/rom/ldap/attribute.rb, line 269
def lte(value)
  [:op_lte, name, value]
end
Also aliased as: <=
multiple?() click to toggle source

OID permits multiple values?

@return [Boolean]

@api public

# File lib/rom/ldap/attribute.rb, line 48
def multiple?
  meta[:single].equal?(false)
end
not(value) click to toggle source

@param value [Mixed]

@example

users.where { id.not(1) }
users.where { id != 1 }

@return [Array]

@api public

# File lib/rom/ldap/attribute.rb, line 213
def not(value)
  [:con_not, is(value)]
end
Also aliased as: !=
not_like(value) click to toggle source

@param value [Mixed]

@example

users.where { given_name.not_like('peter') }
users.where { given_name !~ 'peter' }

@return [Array]

@api public

# File lib/rom/ldap/attribute.rb, line 297
def not_like(value)
  [:con_not, like(value)]
end
Also aliased as: !~
oid() click to toggle source

Attribute Numeric Object Identifier

@return [String]

@api public

# File lib/rom/ldap/attribute.rb, line 93
def oid
  meta[:oid]
end
original_name()
Alias for: to_s
single?() click to toggle source

Attribute definition identifies this attribute can not have multiple values.

@return [Boolean]

@api public

# File lib/rom/ldap/attribute.rb, line 39
def single?
  meta[:single].equal?(true)
end
syntax() click to toggle source

Attribute's syntax Numeric Object Identifier

@return [String]

@api public

# File lib/rom/ldap/attribute.rb, line 111
def syntax
  meta[:syntax]
end
to_s() click to toggle source

Convert to string for ldap query using original name The canonical attribute name defined in RFC4512.

@return [String]

@api public

# File lib/rom/ldap/attribute.rb, line 130
def to_s
  meta[:canonical] || name.to_s
end
Also aliased as: original_name
~@()
Alias for: exists