Skip to content

Commit 7d1bd79

Browse files
committed
is_switch_value => is_treated_as_value; force_value => is_value
1 parent dc3f45d commit 7d1bd79

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/thor/parser/options.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def initialize(hash_options = {}, defaults = {}, stop_on_unknown = false, disabl
4545
@switches = {}
4646
@extra = []
4747
@stopped_parsing_after_extra_index = nil
48-
@is_switch_value = false
48+
@is_treated_as_value = false
4949

5050
options.each do |option|
5151
@switches[option.switch_name] = option
@@ -76,18 +76,18 @@ def peek
7676
end
7777

7878
def shift
79-
@is_switch_value = false
79+
@is_treated_as_value = false
8080
super
8181
end
8282

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
8585
super(arg)
8686
end
8787

8888
def parse(args) # rubocop:disable MethodLength
8989
@pile = args.dup
90-
@is_switch_value = false
90+
@is_treated_as_value = false
9191
@parsing_options = true
9292

9393
while peek
@@ -101,7 +101,7 @@ def parse(args) # rubocop:disable MethodLength
101101
unshift($1.split("").map { |f| "-#{f}" })
102102
next
103103
when EQ_RE
104-
unshift($2, force_value: true)
104+
unshift($2, is_value: true)
105105
switch = $1
106106
when SHORT_NUM
107107
unshift($2)
@@ -163,7 +163,7 @@ def assign_result!(option, result)
163163
# Two booleans are returned. The first is true if the current value
164164
# starts with a hyphen; the second is true if it is a registered switch.
165165
def current_is_switch?
166-
return [false, false] if @is_switch_value
166+
return [false, false] if @is_treated_as_value
167167
case peek
168168
when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM
169169
[true, switch?($1)]
@@ -175,7 +175,7 @@ def current_is_switch?
175175
end
176176

177177
def current_is_switch_formatted?
178-
return false if @is_switch_value
178+
return false if @is_treated_as_value
179179
case peek
180180
when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM, SHORT_SQ_RE
181181
true
@@ -185,7 +185,7 @@ def current_is_switch_formatted?
185185
end
186186

187187
def current_is_value?
188-
return true if @is_switch_value
188+
return true if @is_treated_as_value
189189
peek && (!parsing_options? || super)
190190
end
191191

0 commit comments

Comments
 (0)