Class: Timert::ArgumentParser
- Inherits:
-
Object
- Object
- Timert::ArgumentParser
- Defined in:
- lib/timert/argument_parser.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#argument ⇒ Object
readonly
Returns the value of attribute argument.
Instance Method Summary collapse
-
#initialize(args) ⇒ ArgumentParser
constructor
A new instance of ArgumentParser.
Constructor Details
#initialize(args) ⇒ ArgumentParser
Returns a new instance of ArgumentParser.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/timert/argument_parser.rb', line 7 def initialize(args) if args.empty? @action = "help" @argument = nil elsif is_api?(args[0]) @action = args[0] @argument = api_argument(@action, *args[1..-1]) else @action = 'add_task' @argument = args.join(" ") end end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
5 6 7 |
# File 'lib/timert/argument_parser.rb', line 5 def action @action end |
#argument ⇒ Object (readonly)
Returns the value of attribute argument.
5 6 7 |
# File 'lib/timert/argument_parser.rb', line 5 def argument @argument end |