Class: Tagomatic::LocalOptionsMatcher
- Inherits:
-
Object
- Object
- Tagomatic::LocalOptionsMatcher
- Defined in:
- lib/tagomatic/local_options_matcher.rb
Constant Summary collapse
- LOCAL_OPTIONS_ENTRY_REGEX =
/(--[^ ]+)( (.+))?/
- OPTION_MATCH_GROUP_INDEX =
0
- VALUE_MATCH_GROUP_INDEX =
2
Instance Method Summary collapse
- #get_option ⇒ Object
- #get_value ⇒ Object
- #has_value? ⇒ Boolean
- #is_valid_option? ⇒ Boolean
- #process!(line) ⇒ Object
- #to_argv ⇒ Object
Instance Method Details
#get_option ⇒ Object
13 14 15 |
# File 'lib/tagomatic/local_options_matcher.rb', line 13 def get_option @matchdata.captures[OPTION_MATCH_GROUP_INDEX] end |
#get_value ⇒ Object
21 22 23 |
# File 'lib/tagomatic/local_options_matcher.rb', line 21 def get_value @matchdata.captures[VALUE_MATCH_GROUP_INDEX] end |
#has_value? ⇒ Boolean
17 18 19 |
# File 'lib/tagomatic/local_options_matcher.rb', line 17 def has_value? @matchdata.captures.size > 2 end |
#is_valid_option? ⇒ Boolean
9 10 11 |
# File 'lib/tagomatic/local_options_matcher.rb', line 9 def is_valid_option? @matchdata.captures.size > 0 end |
#process!(line) ⇒ Object
5 6 7 |
# File 'lib/tagomatic/local_options_matcher.rb', line 5 def process!(line) @matchdata = LOCAL_OPTIONS_ENTRY_REGEX.match(line) end |
#to_argv ⇒ Object
25 26 27 28 29 30 |
# File 'lib/tagomatic/local_options_matcher.rb', line 25 def to_argv argv = [] argv << get_option if is_valid_option? argv << get_value if has_value? argv end |