Class: HecksApplication::CommandRunner

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

Overview

Run an application command, with validations and broacast lifecycle events

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command_name:, module_name:, args:, application:, async: false) ⇒ CommandRunner

Returns a new instance of CommandRunner.



8
9
10
11
12
13
14
15
# File 'lib/command_runner.rb', line 8

def initialize(command_name:, module_name:, args:, application:, async: false)
  @command_name = command_name
  @module_name  = module_name
  @args         = args
  @application  = application
  @domain_spec  = application.domain_spec
  @async        = async
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



6
7
8
# File 'lib/command_runner.rb', line 6

def command
  @command
end

#module_nameObject (readonly)

Returns the value of attribute module_name.



6
7
8
# File 'lib/command_runner.rb', line 6

def module_name
  @module_name
end

Instance Method Details

#callObject



17
18
19
20
21
22
# File 'lib/command_runner.rb', line 17

def call()
  fetch_command
  run_command
  broadcast
  command
end