Class: Hindbaer::Clip

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

Constant Summary collapse

ATTRIBUTES =
%w{
ref name length leq
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Clip

Returns a new instance of Clip.



18
19
20
# File 'lib/hindbaer/clip.rb', line 18

def initialize(&block)
  block.arity > 0 ? block.call(self) : instance_eval(&block)
end

Class Method Details

.parse(doc) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/hindbaer/clip.rb', line 10

def self.parse(doc)
  new do
    ATTRIBUTES.each do |attribute|
      self.send("#{attribute.to_sym}=", doc[attribute.capitalize])
    end
  end
end

Instance Method Details

#to_xml(xml) ⇒ Object



22
23
24
# File 'lib/hindbaer/clip.rb', line 22

def to_xml(xml)
  xml.Clip Ref: ref, Name: name, Length: length, Leq: leq
end