Class: Hindbaer::Plugin::Base

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

Direct Known Subclasses

Compressor, Equalizer, VoiceProfiler

Constant Summary collapse

ATTRIBUTES =
%w{
  id name bypass
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Base

Returns a new instance of Base.



23
24
25
# File 'lib/hindbaer/plugin/base.rb', line 23

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

Class Method Details

.parse(fragment) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/hindbaer/plugin/base.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.uid = fragment['UID']
  end
end

Instance Method Details

#to_xml(xml) ⇒ Object



27
28
29
# File 'lib/hindbaer/plugin/base.rb', line 27

def to_xml(xml)
  xml.Plugin Id: id, Name: name, UID: uid, Bypass: bypass
end