Method: XMP::Namespace#initialize

Defined in:
lib/xmp/namespace.rb

#initialize(xmp, namespace) ⇒ Namespace

:nodoc



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/xmp/namespace.rb', line 6

def initialize(xmp, namespace) # :nodoc
  @xmp = xmp
  @namespace = namespace.to_s

  @attributes = []
  embedded_attributes =
    xml.xpath("//rdf:Description").map { |d|
      d.attributes.values.
        select { |attr| attr.namespace ? attr.namespace.prefix.to_s : nil == @namespace }.
        map(&:name)
    }.flatten
  @attributes.concat embedded_attributes
  standalone_attributes = xml.xpath("//rdf:Description/#{@namespace}:*").
                              map(&:name)
  @attributes.concat standalone_attributes
end