module ActiveFedora::RegisteredAttributes::ClassMethods

Public Instance Methods

attribute(attribute_name, options ={}) click to toggle source
# File lib/active_fedora/registered_attributes.rb, line 45
def attribute(attribute_name, options ={})
  self.attribute_registry.register(attribute_name, options) do |attribute|

    attribute.with_validation_options do |name, opts|
      validates(name, opts)
    end

    attribute.with_accession_options do |name, opts|
      attr_accessor name
    end

    attribute.with_delegation_options do |name, opts|
      has_attributes(name, opts)
    end

    attribute.wrap_writer_method(self)
    attribute.wrap_reader_method(self)
  end
end
attribute_registry() click to toggle source
# 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() click to toggle source
# File lib/active_fedora/registered_attributes.rb, line 41
def displayable_attributes
  attribute_registry.displayable_attributes
end
editable_attributes() click to toggle source
# File lib/active_fedora/registered_attributes.rb, line 37
def editable_attributes
  attribute_registry.editable_attributes
end
registered_attribute_names() click to toggle source
# File lib/active_fedora/registered_attributes.rb, line 33
def registered_attribute_names
  attribute_registry.keys.collect(&:to_s)
end