Class: Slop
- Inherits:
-
Object
- Object
- Slop
- Defined in:
- lib/hem/patches/slop.rb
Defined Under Namespace
Classes: Option
Instance Attribute Summary collapse
-
#arg_list(list = nil) ⇒ Object
Returns the value of attribute arg_list.
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#hidden(value = nil) ⇒ Object
Returns the value of attribute hidden.
-
#long_desc ⇒ Object
Returns the value of attribute long_desc.
-
#unparsed ⇒ Object
Returns the value of attribute unparsed.
Instance Method Summary collapse
-
#description(desc = nil) ⇒ Object
Slop has a description method but it uses @config which is inherited This is not desired behaviour.
- #long_description(desc = nil) ⇒ Object
- #old_parse! ⇒ Object
- #parse!(items = ARGV, &block) ⇒ Object
- #project_only(value = nil) ⇒ Object
Instance Attribute Details
#arg_list(list = nil) ⇒ Object
Returns the value of attribute arg_list.
2 3 4 |
# File 'lib/hem/patches/slop.rb', line 2 def arg_list @arg_list end |
#desc ⇒ Object
Returns the value of attribute desc.
2 3 4 |
# File 'lib/hem/patches/slop.rb', line 2 def desc @desc end |
#hidden(value = nil) ⇒ Object
Returns the value of attribute hidden.
2 3 4 |
# File 'lib/hem/patches/slop.rb', line 2 def hidden @hidden end |
#long_desc ⇒ Object
Returns the value of attribute long_desc.
2 3 4 |
# File 'lib/hem/patches/slop.rb', line 2 def long_desc @long_desc end |
#unparsed ⇒ Object
Returns the value of attribute unparsed.
2 3 4 |
# File 'lib/hem/patches/slop.rb', line 2 def unparsed @unparsed end |
Instance Method Details
#description(desc = nil) ⇒ Object
Slop has a description method but it uses @config which is inherited This is not desired behaviour
6 7 8 9 |
# File 'lib/hem/patches/slop.rb', line 6 def description desc = nil @desc = desc if desc @desc end |
#long_description(desc = nil) ⇒ Object
11 12 13 14 |
# File 'lib/hem/patches/slop.rb', line 11 def long_description desc = nil @long_desc = desc if desc @long_desc end |
#old_parse! ⇒ Object
31 |
# File 'lib/hem/patches/slop.rb', line 31 alias :old_parse! :parse! |
#parse!(items = ARGV, &block) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/hem/patches/slop.rb', line 32 def parse!(items = ARGV, &block) if @unparsed.nil? split_index = items.index('--') unparsed = [] unless split_index.nil? unparsed = items.slice(split_index + 1, items.length) items = items.slice(0, split_index) end @unparsed = unparsed.map do |c| "\'#{c.gsub("'", '\\\'').gsub('(', '\\(').gsub(')', '\\)')}\'" end.join(' ') end old_parse!(items, &block) end |
#project_only(value = nil) ⇒ Object
26 27 28 29 |
# File 'lib/hem/patches/slop.rb', line 26 def project_only value = nil @config[:project_only] = value unless value.nil? @config[:project_only] end |