Module: ActiveFedora::RegisteredAttributes::ClassMethods
- Defined in:
- lib/active_fedora/registered_attributes.rb
Instance Method Summary collapse
- #attribute(attribute_name, options = {}) ⇒ Object
- #attribute_registry ⇒ Object
- #displayable_attributes ⇒ Object
- #editable_attributes ⇒ Object
- #registered_attribute_names ⇒ Object
Instance Method Details
#attribute(attribute_name, options = {}) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/active_fedora/registered_attributes.rb', line 45 def attribute(attribute_name, ={}) self.attribute_registry.register(attribute_name, ) do |attribute| attribute. do |name, opts| validates(name, opts) end attribute. do |name, opts| attr_accessor name end attribute. do |name, opts| has_attributes(name, opts) end attribute.wrap_writer_method(self) attribute.wrap_reader_method(self) end end |
#attribute_registry ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/active_fedora/registered_attributes.rb', line 22 def attribute_registry @attribute_registry ||= begin if superclass.respond_to?(:attribute_registry) superclass.attribute_registry.copy_to(self) else AttributeRegistry.new(self) end end end |
#displayable_attributes ⇒ Object
41 42 43 |
# File 'lib/active_fedora/registered_attributes.rb', line 41 def displayable_attributes attribute_registry.displayable_attributes end |
#editable_attributes ⇒ Object
37 38 39 |
# File 'lib/active_fedora/registered_attributes.rb', line 37 def editable_attributes attribute_registry.editable_attributes end |
#registered_attribute_names ⇒ Object
33 34 35 |
# File 'lib/active_fedora/registered_attributes.rb', line 33 def registered_attribute_names attribute_registry.keys.collect(&:to_s) end |