Class: AD::Framework::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/ad-framework/attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Attribute

Returns a new instance of Attribute.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ad-framework/attribute.rb', line 9

def initialize(name)
  self.name = name
  definition = AD::Framework.defined_attributes.find(self.name)
  if !definition
    raise(AD::Framework::AttributeNotDefined, "There is no attribute defintion for #{name.inspect}.")
  end
  self.ldap_name = definition.ldap_name
  self.attribute_type = AD::Framework.defined_attribute_types.find(definition.type)
  if !self.attribute_type
    raise(*[
      AD::Framework::AttributeTypeNotDefined, 
      "There is no attribute type defined for #{definition.type.inspect}"
    ])
  end
end

Instance Attribute Details

#attribute_typeObject

Returns the value of attribute attribute_type.



7
8
9
# File 'lib/ad-framework/attribute.rb', line 7

def attribute_type
  @attribute_type
end

#ldap_nameObject

Returns the value of attribute ldap_name.



7
8
9
# File 'lib/ad-framework/attribute.rb', line 7

def ldap_name
  @ldap_name
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/ad-framework/attribute.rb', line 7

def name
  @name
end

Instance Method Details

#define_reader(klass) ⇒ Object



25
26
27
# File 'lib/ad-framework/attribute.rb', line 25

def define_reader(klass)
  self.attribute_type.define_reader(self, klass)
end

#define_writer(klass) ⇒ Object



28
29
30
# File 'lib/ad-framework/attribute.rb', line 28

def define_writer(klass)
  self.attribute_type.define_writer(self, klass)
end