Class: Hindbaer::Fade

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

Constant Summary collapse

ATTRIBUTES =
%w{
start length gain
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Fade

Returns a new instance of Fade.



18
19
20
# File 'lib/hindbaer/fade.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/fade.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/fade.rb', line 22

def to_xml(xml)
  xml.Fade Start: start, Length: length, Gain: gain
end