Class: Dirwatch::Options::Parser
- Defined in:
- lib/dirwatch/options/parser.rb
Direct Known Subclasses
Constant Summary collapse
- COMMAND_NAME =
'dirwatch'.freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #action ⇒ Object
- #command_name ⇒ Object
-
#initialize(alternatives) ⇒ Parser
constructor
A new instance of Parser.
- #parse!(args) ⇒ Object
Constructor Details
#initialize(alternatives) ⇒ Parser
Returns a new instance of Parser.
20 21 22 |
# File 'lib/dirwatch/options/parser.rb', line 20 def initialize alternatives @alternatives = alternatives end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
18 19 20 |
# File 'lib/dirwatch/options/parser.rb', line 18 def @options end |
Class Method Details
.from_args(args) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/dirwatch/options/parser.rb', line 9 def self.from_args args if args.first == 'init' args.shift InitParser.new [WatchParser.command_name] else WatchParser.new [InitParser.command_name] end end |
Instance Method Details
#action ⇒ Object
32 33 34 |
# File 'lib/dirwatch/options/parser.rb', line 32 def action self.class.action end |
#command_name ⇒ Object
28 29 30 |
# File 'lib/dirwatch/options/parser.rb', line 28 def command_name self.class.command_name end |
#parse!(args) ⇒ Object
24 25 26 |
# File 'lib/dirwatch/options/parser.rb', line 24 def parse! args build.parse! args end |