module FedoraLens::AttributeMethods::Declarations::ClassMethods

Public Instance Methods

attribute(name, path) click to toggle source
# File lib/fedora_lens/attribute_methods/declarations.rb, line 22
def attribute(name, path)
  raise AttributeNotSupportedException if name.to_sym == :id
  attributes_as_lenses[name] = path.map{|s| coerce_to_lens(s)}
  generate_method(name)
  orm_to_hash = nil # force us to rebuild the aggregate_lens in case it was already built.
end

Private Instance Methods

coerce_to_lens(path_segment) click to toggle source
# File lib/fedora_lens/attribute_methods/declarations.rb, line 30
def coerce_to_lens(path_segment)
  if path_segment.is_a? RDF::URI
    Lenses.get_predicate(path_segment)
  else
    path_segment
  end
end