Class: AD::Framework::Utilities::EntryBuilder
- Inherits:
-
Object
- Object
- AD::Framework::Utilities::EntryBuilder
- Defined in:
- lib/ad-framework/utilities/entry_builder.rb
Instance Attribute Summary collapse
-
#entry ⇒ Object
Returns the value of attribute entry.
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#ldap_entry ⇒ Object
Returns the value of attribute ldap_entry.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(ldap_entry, options = {}) ⇒ EntryBuilder
constructor
A new instance of EntryBuilder.
- #reload ⇒ Object
Constructor Details
#initialize(ldap_entry, options = {}) ⇒ EntryBuilder
Returns a new instance of EntryBuilder.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ad-framework/utilities/entry_builder.rb', line 13 def initialize(ldap_entry, = {}) self.ldap_entry = ldap_entry if self.ldap_entry self.fields = AD::Framework::Fields.new(self.ldap_entry || {}) if [:reload] self.entry = [:reload] self.reload else self.build end end end |
Instance Attribute Details
#entry ⇒ Object
Returns the value of attribute entry.
11 12 13 |
# File 'lib/ad-framework/utilities/entry_builder.rb', line 11 def entry @entry end |
#fields ⇒ Object
Returns the value of attribute fields.
11 12 13 |
# File 'lib/ad-framework/utilities/entry_builder.rb', line 11 def fields @fields end |
#ldap_entry ⇒ Object
Returns the value of attribute ldap_entry.
11 12 13 |
# File 'lib/ad-framework/utilities/entry_builder.rb', line 11 def ldap_entry @ldap_entry end |
Instance Method Details
#build ⇒ Object
35 36 37 38 39 |
# File 'lib/ad-framework/utilities/entry_builder.rb', line 35 def build structure = self.classes_structure self.entry = structure[:structural_class].new({ :fields => self.fields }) self.link_auxiliary_classes(structure) end |
#reload ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/ad-framework/utilities/entry_builder.rb', line 27 def reload self.entry.fields = self.fields self.entry.schema.attributes.each do |name| self.entry.send("#{name}_attribute_type").reset end self.link_auxiliary_classes end |