Class: AlexaSkillResponseCollection

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

Instance Method Summary collapse

Constructor Details

#initialize(skills = {}, debug: false, rsc: nil, whitelist: {users: nil, devices: nil}) ⇒ AlexaSkillResponseCollection

Returns a new instance of AlexaSkillResponseCollection.



147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/alexa_skillresponse.rb', line 147

def initialize(skills={}, debug: false, rsc: nil, 
               whitelist: {users: nil, devices: nil})
  
  @debug = debug
  @skills = skills.inject({}) do |r, x|
    
    package_name, rsf_package = x
    asr = AlexaSkillResponse.new(rsf_package, debug: debug, rsc: rsc, 
                                 whitelist: whitelist)
    r.merge(package_name => asr)
        
  end
  
end

Instance Method Details

#run(skill, h) ⇒ Object



162
163
164
165
166
167
168
# File 'lib/alexa_skillresponse.rb', line 162

def run(skill, h)
  
  puts 'skill: ' + skill.inspect if @debug
  puts '@skills: ' + @skills.inspect if @debug
  @skills[skill].run h

end