Class: R4DigitalNZ::Section

Inherits:
Object
  • Object
show all
Defined in:
lib/r4digitalnz.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Section

Returns a new instance of Section.



112
113
114
115
116
117
118
119
120
121
122
# File 'lib/r4digitalnz.rb', line 112

def initialize hash
  @id = hash['ID']
  @mime_type = hash['mdWrap']['MIMETYPE']
  @mdtype = hash['mdWrap']['MDTYPE']
  
  hash['mdWrap']['xmlData'].each do |k,v|
      (class << self; self;end).class_eval do
        define_method(k.gsub(':', '_').to_sym) { v }
      end      
  end
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



108
109
110
# File 'lib/r4digitalnz.rb', line 108

def id
  @id
end

#mdtypeObject (readonly)

Returns the value of attribute mdtype.



110
111
112
# File 'lib/r4digitalnz.rb', line 110

def mdtype
  @mdtype
end

#mime_typeObject (readonly)

Returns the value of attribute mime_type.



109
110
111
# File 'lib/r4digitalnz.rb', line 109

def mime_type
  @mime_type
end

Instance Method Details

#inspectObject



124
125
126
127
128
129
130
131
# File 'lib/r4digitalnz.rb', line 124

def inspect
  out  = "#<#R4DigitalNZ::Section:#{self.object_id} "
  public_methods(false).sort.each do |m|
    next if m == "inspect"
    out << ", @#{m}=\"#{send(m.to_sym)}\""
  end
  out << ">"
end