Class: Ralyxa::RegisterIntents

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

Constant Summary collapse

DEFAULT_INTENTS_DIRECTORY =
'./intents'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(intents_directory, alexa_skill_class) ⇒ RegisterIntents

Returns a new instance of RegisterIntents.



7
8
9
10
# File 'lib/ralyxa/register_intents.rb', line 7

def initialize(intents_directory, alexa_skill_class)
  @intents_directory = intents_directory
  @alexa_skill_class = alexa_skill_class
end

Class Method Details

.run(intents_directory = DEFAULT_INTENTS_DIRECTORY, alexa_skill_class = Ralyxa::Skill) ⇒ Object



12
13
14
# File 'lib/ralyxa/register_intents.rb', line 12

def self.run(intents_directory = DEFAULT_INTENTS_DIRECTORY, alexa_skill_class = Ralyxa::Skill)
  new(intents_directory, alexa_skill_class).run
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
# File 'lib/ralyxa/register_intents.rb', line 16

def run
  warn NO_INTENT_DECLARATIONS_FOUND if intent_declarations.empty?

  intent_declarations.each do |intent_declaration|
    alexa_skill_class.class_eval intent_declaration
  end
end