Class: Hindbaer::File
- Inherits:
-
Object
- Object
- Hindbaer::File
- Defined in:
- lib/hindbaer/file.rb
Constant Summary collapse
- ATTRIBUTES =
%w{ id name duration channels leq dyn }
Instance Attribute Summary collapse
-
#original_path ⇒ Object
Returns the value of attribute original_path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(&block) ⇒ File
constructor
A new instance of File.
- #to_xml(xml) ⇒ Object
Constructor Details
#initialize(&block) ⇒ File
Returns a new instance of File.
23 24 25 |
# File 'lib/hindbaer/file.rb', line 23 def initialize(&block) block.arity > 0 ? block.call(self) : instance_eval(&block) end |
Instance Attribute Details
#original_path ⇒ Object
Returns the value of attribute original_path.
10 11 12 |
# File 'lib/hindbaer/file.rb', line 10 def original_path @original_path end |
Class Method Details
.parse(doc) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/hindbaer/file.rb', line 12 def self.parse(doc) new do ATTRIBUTES.each do |attribute| self.send("#{attribute.to_sym}=", doc[attribute.capitalize]) end self.original_path = doc.at_css('MetaData')['OriginalPath'] if doc.at_css('MetaData') end end |
Instance Method Details
#to_xml(xml) ⇒ Object
27 28 29 30 31 |
# File 'lib/hindbaer/file.rb', line 27 def to_xml(xml) xml.File Id: id, Name: name, Duration: duration, Channels: channels, Leq: leq do xml.MetaData OriginalPath: original_path end end |