Class: Hindbaer::Group
- Inherits:
-
Object
- Object
- Hindbaer::Group
- Defined in:
- lib/hindbaer/group.rb
Constant Summary collapse
- ATTRIBUTES =
%w{ caption used }
Instance Attribute Summary collapse
-
#clips ⇒ Object
Returns the value of attribute clips.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(&block) ⇒ Group
constructor
A new instance of Group.
- #to_xml(xml) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Group
Returns a new instance of Group.
24 25 26 27 28 |
# File 'lib/hindbaer/group.rb', line 24 def initialize(&block) self.clips = [] block.arity > 0 ? block.call(self) : instance_eval(&block) end |
Instance Attribute Details
#clips ⇒ Object
Returns the value of attribute clips.
9 10 11 |
# File 'lib/hindbaer/group.rb', line 9 def clips @clips end |
Class Method Details
.parse(fragment) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/hindbaer/group.rb', line 11 def self.parse(fragment) new do ATTRIBUTES.each do |attribute| self.send( "#{attribute.to_sym}=", fragment[attribute.split('_').map(&:capitalize).join] ) end self.clips = fragment.css('Clip').map { |c| Hindbaer::Clip.parse(c) } end end |
Instance Method Details
#to_xml(xml) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/hindbaer/group.rb', line 30 def to_xml(xml) xml.Group Caption: , Used: used do clips.each do |clip| clip.to_xml(xml) end end end |