Class: Burn::Dsl::Sound

Inherits:
DslBase show all
Defined in:
lib/burn/dsl/sound.rb

Instance Method Summary collapse

Methods inherited from DslBase

#method_missing

Methods included from Burn::Debug

#log

Constructor Details

#initialize(resource_name, context) ⇒ Sound

Returns a new instance of Sound.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/burn/dsl/sound.rb', line 4

def initialize(resource_name, context)
  super(resource_name, context)
  
  if resource_name.nil? then
    raise Exception.new "Resource name for Sound class must be provided."
  else
    @resource_name = resource_name
  end
  
  @context.instance_exec resource_name, &lambda{|resource_name|
    @resources["#{resource_name}"] = Array.new
  }
  
  @se = SoundEffect.new
  
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Burn::Dsl::DslBase

Instance Method Details

#effect(&block) ⇒ Object



21
22
23
24
25
26
# File 'lib/burn/dsl/sound.rb', line 21

def effect(&block)
  @context.instance_exec(@resource_name,@se) do |resource_name,se|
    se.load(&block)
    @resources["#{resource_name}"] << se.generate
  end
end