From fc1afdcb72d786836479367ef42d7d82069aaf97 Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Sun, 26 Mar 2023 15:42:56 +1300 Subject: More refactoring --- spec/practical/json_spec.cr | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'spec/practical/json_spec.cr') diff --git a/spec/practical/json_spec.cr b/spec/practical/json_spec.cr index ed0fcfb..95795e2 100644 --- a/spec/practical/json_spec.cr +++ b/spec/practical/json_spec.cr @@ -20,12 +20,12 @@ struct JSONValue end def json_null - Parser.token_sequence("null".chars).map { |_| JSONValue.new(nil) } + Parser.token_sequence("null".chars).map_const(JSONValue.new(nil)) end def json_bool - t = Parser.token_sequence("true".chars).map { |_| true } - f = Parser.token_sequence("false".chars).map { |_| false } + t = Parser.token_sequence("true".chars).map_const(true) + f = Parser.token_sequence("false".chars).map_const(false) (t | f).map { |b| JSONValue.new(b) } end @@ -34,7 +34,7 @@ def json_number base_num = Parser(Char, Char).satisfy(&.ascii_number?).some.map do |cs| cs.join.to_i64 end - sign = Parser.token('-').map { |_| -1 }.recover(1) + sign = Parser.token('-').map_const(-1).recover(1) (sign + base_num).map { |s, n| JSONValue.new(s.to_i64 * n) } end -- cgit v1.2.1