Class: Hindbaer::Region
- Inherits:
-
Object
- Object
- Hindbaer::Region
- Defined in:
- lib/hindbaer/region.rb
Constant Summary collapse
- ATTRIBUTES =
%w{ ref name start offset length fade_in fade_out gain leq dynamics }
Instance Attribute Summary collapse
-
#fades ⇒ Object
Returns the value of attribute fades.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(&block) ⇒ Region
constructor
A new instance of Region.
Constructor Details
#initialize(&block) ⇒ Region
Returns a new instance of Region.
28 29 30 31 32 |
# File 'lib/hindbaer/region.rb', line 28 def initialize(&block) self.fades = [] block.arity > 0 ? block.call(self) : instance_eval(&block) end |
Instance Attribute Details
#fades ⇒ Object
Returns the value of attribute fades.
9 10 11 |
# File 'lib/hindbaer/region.rb', line 9 def fades @fades end |
Class Method Details
.parse(fragment) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/hindbaer/region.rb', line 11 def self.parse(fragment) new do ATTRIBUTES.each do |attribute| self.send( "#{attribute.to_sym}=", fragment[attribute.split('_').map(&:capitalize).join] ) self.start = '00.0' unless start self.fades = fragment.css('Fade').map do |f| Hindbaer::Fade.parse(f) end end end end |