Skip to content

Commit 72ec87e

Browse files
committed
fix rubocops around to_sym, kind_of, gsub
1 parent 379267d commit 72ec87e

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

lib/floe/workflow/choice_rule/data.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,16 @@ def parse_compare_key
111111
if (match_values = OPERATION.match(key))
112112
@compare_key = key
113113
@type, operator, @path = match_values.captures
114-
@operation = "op_#{operator.downcase}?".to_sym
114+
@operation = :"op_#{operator.downcase}?"
115115
@compare_predicate = parse_predicate(type)
116116
break
117-
end
118117
# e.g. (Is)(String)
119-
if (match_value = TYPE_CHECK.match(key))
118+
elsif (match_value = TYPE_CHECK.match(key))
120119
@compare_key = key
121120
_operator, type = match_value.captures
122121
# type: nil means no runtime type checking.
123122
@type = @path = nil
124-
@operation = "is_#{type.downcase}?".to_sym
123+
@operation = :"is_#{type.downcase}?"
125124
@compare_predicate = parse_predicate("Boolean")
126125
break
127126
end
@@ -181,7 +180,7 @@ def fetch_path(field_name, field_path, context, input)
181180
# if we have runtime checking, check against that type
182181
# otherwise assume checking a TYPE_CHECK predicate and check against Boolean
183182
def correct_type?(value, data_type)
184-
send("is_#{data_type.downcase}?".to_sym, value)
183+
send(:"is_#{data_type.downcase}?", value)
185184
end
186185
end
187186
end

lib/floe/workflow/context.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def to_h
148148
end
149149

150150
def ==(other)
151-
other.is_a?(self.class) && other.instance_variable_get("@context") == @context
151+
other.kind_of?(self.class) && other.instance_variable_get(:@context) == @context
152152
end
153153
alias eql? ==
154154

spec/workflow/context_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@
201201
describe "#inspect" do
202202
it "has the same value with or without credentials" do
203203
# removing spaces because Hash#inspect in ruby 3.4 adds spaces that are not present before
204-
expect(ctx.inspect.gsub(" ", "")).to eq("#<Floe::Workflow::Context: {\"Execution\" => {\"Input\" => {\"x\" => \"y\"}}, \"State\" => {}, \"StateHistory\" => [], \"StateMachine\" => {}, \"Task\" => {}}>".gsub(" ", ""))
205-
expect(ctx_creds.inspect.gsub(" ", "")).to eq("#<Floe::Workflow::Context: {\"Execution\" => {\"Input\" => {\"x\" => \"y\"}}, \"State\" => {}, \"StateHistory\" => [], \"StateMachine\" => {}, \"Task\" => {}}>".gsub(" ", ""))
204+
expect(ctx.inspect.delete(" ")).to eq("#<Floe::Workflow::Context: {\"Execution\" => {\"Input\" => {\"x\" => \"y\"}}, \"State\" => {}, \"StateHistory\" => [], \"StateMachine\" => {}, \"Task\" => {}}>".delete(" "))
205+
expect(ctx_creds.inspect.delete(" ")).to eq("#<Floe::Workflow::Context: {\"Execution\" => {\"Input\" => {\"x\" => \"y\"}}, \"State\" => {}, \"StateHistory\" => [], \"StateMachine\" => {}, \"Task\" => {}}>".delete(" "))
206206
end
207207

208208
it "doesn't expose credentials" do
@@ -238,7 +238,7 @@
238238
end
239239
end
240240

241-
describe "#eql?" do
241+
describe "#eql?" do
242242
it "compares with values" do
243243
ctx1 = described_class.new(:input => input.to_json)
244244
ctx2 = described_class.new(:input => input.to_json)

0 commit comments

Comments
 (0)