Module: Moses
- Included in:
- Application
- Defined in:
- lib/moses.rb
Defined Under Namespace
Modules: ClassMethods Classes: Application
Constant Summary collapse
- VERSION_FILE =
'VERSION'- HELP_FILE =
'HELP'
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#default_command ⇒ Object
readonly
Returns the value of attribute default_command.
-
#default_option_commands ⇒ Object
readonly
Returns the value of attribute default_option_commands.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
6 7 8 |
# File 'lib/moses.rb', line 6 def args @args end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
6 7 8 |
# File 'lib/moses.rb', line 6 def command @command end |
#default_command ⇒ Object (readonly)
Returns the value of attribute default_command.
6 7 8 |
# File 'lib/moses.rb', line 6 def default_command @default_command end |
#default_option_commands ⇒ Object (readonly)
Returns the value of attribute default_option_commands.
7 8 9 |
# File 'lib/moses.rb', line 7 def default_option_commands @default_option_commands end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/moses.rb', line 6 def end |
Class Method Details
.included(base) ⇒ Object
35 36 37 |
# File 'lib/moses.rb', line 35 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#default_commands ⇒ Object
43 44 45 |
# File 'lib/moses.rb', line 43 def default_commands @default_commands ||= [:help, :version] end |
#output ⇒ Object
39 40 41 |
# File 'lib/moses.rb', line 39 def output @output ||= $stdout end |
#run ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/moses.rb', line 56 def run = {} @args = Array.try_convert ARGV parse_command set_option_command self.send(@command) if valid_command? self.send(@default_command || :help) if @command.nil? end |