Class: Pechkin::Command::Base
- Inherits:
-
Object
- Object
- Pechkin::Command::Base
show all
- Defined in:
- lib/pechkin/command/base.rb
Overview
Basic class for all commands
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options, stdout: $stdout, stderr: $stderr) ⇒ Base
Initializes command state
12
13
14
15
16
|
# File 'lib/pechkin/command/base.rb', line 12
def initialize(options, stdout: $stdout, stderr: $stderr)
@options = options
@stdout = stdout
@stderr = stderr
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
5
6
7
|
# File 'lib/pechkin/command/base.rb', line 5
def options
@options
end
|
Instance Method Details
#configuration ⇒ Object
18
19
20
21
|
# File 'lib/pechkin/command/base.rb', line 18
def configuration
config_dir = options.config_dir
@configuration ||= Configuration.load_from_directory(config_dir)
end
|
#handler ⇒ Object
23
24
25
|
# File 'lib/pechkin/command/base.rb', line 23
def handler
@handler ||= Handler.new(configuration.channels)
end
|
#matches? ⇒ Boolean
27
28
29
|
# File 'lib/pechkin/command/base.rb', line 27
def matches?
raise 'Unimplemented'
end
|
#puts(*args) ⇒ Object
31
32
33
|
# File 'lib/pechkin/command/base.rb', line 31
def puts(*args)
@stdout.puts(*args)
end
|
#warn(*args) ⇒ Object
35
36
37
|
# File 'lib/pechkin/command/base.rb', line 35
def warn(*args)
@stderr.puts(*args)
end
|