Class: HFAM::CommandSet

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

Instance Method Summary collapse

Constructor Details

#initializeCommandSet

Returns a new instance of CommandSet.



3
4
5
6
7
8
# File 'lib/hfam/command_set.rb', line 3

def initialize
  @commands = {
    symlink: ::HFAM::Command::Symlink.new,
    source:  ::HFAM::Command::Source.new
  }
end

Instance Method Details

#dispatch_commands(payload) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/hfam/command_set.rb', line 10

def dispatch_commands(payload)
  payload.commands.each_with_index do |command, index|
    ::HFAM::Logger.error("hfamconfig:#{index + 1} : unknown command '#{command[1][:command]}' with args #{command[1][:args]}") and next if command[0] == :unknown
    
    @commands[command[0]].run(command)
  end
end