@@ -45,7 +45,7 @@ def initialize(hash_options = {}, defaults = {}, stop_on_unknown = false, disabl
45
45
@switches = { }
46
46
@extra = [ ]
47
47
@stopped_parsing_after_extra_index = nil
48
- @is_switch_value = false
48
+ @is_treated_as_value = false
49
49
50
50
options . each do |option |
51
51
@switches [ option . switch_name ] = option
@@ -76,18 +76,18 @@ def peek
76
76
end
77
77
78
78
def shift
79
- @is_switch_value = false
79
+ @is_treated_as_value = false
80
80
super
81
81
end
82
82
83
- def unshift ( arg , force_value : false )
84
- @is_switch_value = force_value
83
+ def unshift ( arg , is_value : false )
84
+ @is_treated_as_value = is_value
85
85
super ( arg )
86
86
end
87
87
88
88
def parse ( args ) # rubocop:disable MethodLength
89
89
@pile = args . dup
90
- @is_switch_value = false
90
+ @is_treated_as_value = false
91
91
@parsing_options = true
92
92
93
93
while peek
@@ -101,7 +101,7 @@ def parse(args) # rubocop:disable MethodLength
101
101
unshift ( $1. split ( "" ) . map { |f | "-#{ f } " } )
102
102
next
103
103
when EQ_RE
104
- unshift ( $2, force_value : true )
104
+ unshift ( $2, is_value : true )
105
105
switch = $1
106
106
when SHORT_NUM
107
107
unshift ( $2)
@@ -163,7 +163,7 @@ def assign_result!(option, result)
163
163
# Two booleans are returned. The first is true if the current value
164
164
# starts with a hyphen; the second is true if it is a registered switch.
165
165
def current_is_switch?
166
- return [ false , false ] if @is_switch_value
166
+ return [ false , false ] if @is_treated_as_value
167
167
case peek
168
168
when LONG_RE , SHORT_RE , EQ_RE , SHORT_NUM
169
169
[ true , switch? ( $1) ]
@@ -175,7 +175,7 @@ def current_is_switch?
175
175
end
176
176
177
177
def current_is_switch_formatted?
178
- return false if @is_switch_value
178
+ return false if @is_treated_as_value
179
179
case peek
180
180
when LONG_RE , SHORT_RE , EQ_RE , SHORT_NUM , SHORT_SQ_RE
181
181
true
@@ -185,7 +185,7 @@ def current_is_switch_formatted?
185
185
end
186
186
187
187
def current_is_value?
188
- return true if @is_switch_value
188
+ return true if @is_treated_as_value
189
189
peek && ( !parsing_options? || super )
190
190
end
191
191
0 commit comments