Class: Mcoin::Command::Common
- Inherits:
-
Base
- Object
- OptionParser
- Base
- Mcoin::Command::Common
show all
- Defined in:
- lib/mcoin/command/common.rb
Overview
Instance Attribute Summary
Attributes inherited from Base
#option
Instance Method Summary
collapse
Methods inherited from Base
description, option, #prepare
Constructor Details
#initialize ⇒ Common
Returns a new instance of Common.
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/mcoin/command/common.rb', line 7
def initialize
super
separator ''
separator 'Commands: '
print_commands
separator ''
separator 'Options: '
on_tail('-v', '--version', 'Show versions') do
puts "Mcoin #{Mcoin::VERSION}"
exit
end
end
|
Instance Method Details
#execute ⇒ Object
36
37
38
|
# File 'lib/mcoin/command/common.rb', line 36
def execute
puts self
end
|
#parse! ⇒ Object
29
30
31
32
33
34
|
# File 'lib/mcoin/command/common.rb', line 29
def parse!
super
rescue OptionParser::InvalidOption
puts self
exit
end
|
#print_commands ⇒ Object
22
23
24
25
26
27
|
# File 'lib/mcoin/command/common.rb', line 22
def print_commands
Command.commands.each do |command|
separator " #{command.downcase}\t" \
"#{Command.const_get(command).description}"
end
end
|