code-ruby 0.15.16 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +3 -3
  3. data/.prettierignore +2 -0
  4. data/.rubocop.yml +121 -5
  5. data/Gemfile +9 -1
  6. data/Gemfile.lock +30 -22
  7. data/VERSION +1 -1
  8. data/bin/bundle +123 -0
  9. data/bin/code +8 -10
  10. data/code-ruby.gemspec +3 -1
  11. data/lib/code/node/dictionary.rb +1 -3
  12. data/lib/code/node/if.rb +20 -15
  13. data/lib/code/node/left_operation.rb +1 -3
  14. data/lib/code/node/right_operation.rb +6 -6
  15. data/lib/code/node/while.rb +6 -6
  16. data/lib/code/object/boolean.rb +1 -1
  17. data/lib/code/object/class.rb +1 -1
  18. data/lib/code/object/code.rb +1 -1
  19. data/lib/code/object/context.rb +1 -1
  20. data/lib/code/object/date.rb +1 -1
  21. data/lib/code/object/decimal.rb +2 -2
  22. data/lib/code/object/dictionary.rb +12 -34
  23. data/lib/code/object/duration.rb +1 -1
  24. data/lib/code/object/function.rb +1 -1
  25. data/lib/code/object/global.rb +1 -1
  26. data/lib/code/object/html.rb +1 -1
  27. data/lib/code/object/integer.rb +2 -2
  28. data/lib/code/object/json.rb +2 -4
  29. data/lib/code/object/list.rb +3 -5
  30. data/lib/code/object/nothing.rb +1 -1
  31. data/lib/code/object/parameter.rb +1 -5
  32. data/lib/code/object/range.rb +1 -1
  33. data/lib/code/object/string.rb +1 -1
  34. data/lib/code/object/time.rb +1 -1
  35. data/lib/code/object.rb +7 -13
  36. data/lib/code/parser/string.rb +7 -7
  37. data/lib/code/type/repeat.rb +1 -1
  38. data/lib/code/version.rb +1 -1
  39. data/lib/code-ruby.rb +1 -1
  40. data/package-lock.json +14 -0
  41. data/package.json +0 -1
  42. data/spec/code/node/call_spec.rb +0 -34
  43. data/spec/code/parser_spec.rb +2 -2
  44. data/spec/code/type_spec.rb +1 -1
  45. data/spec/code_spec.rb +78 -79
  46. metadata +14 -12
  47. data/bin/console +0 -6
  48. data/yarn.lock +0 -4
  49. /data/spec/code/parser/{chained_call.rb → chained_call_spec.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 441325308911e5cba82286bbc9a4be1d33c03b25210dbaeb818bf78c97ce12e4
4
- data.tar.gz: 3b56769984fc4ffa5a1e9a036bfbac8393462dc1e22033804627764aa3b7aabf
3
+ metadata.gz: 3d8e0526c2c649cf532eb5247172d32f52800a1006a4381de261faddfe654f04
4
+ data.tar.gz: 0d2397eb058541a4240162524b6896ece6978affc5aa3536928986f20be263b6
5
5
  SHA512:
6
- metadata.gz: c8d1677af87363f60d2a2321af4539b8912f6c36f3185b7c8bc142ec2470853ea6f5884df3712903ae45cef4da168603620b7f1c9398b99fcd091c90d6a92a82
7
- data.tar.gz: 1ab4328234974b7bd6501af777b5be1e6f76d8398927dd21fc6dfd18d210b19791462793973e7ec3b11dce4941733c9dc60fd0d353da2a59dbca17d5c8a40dac
6
+ metadata.gz: a933f5a095a685a765ecfaa301295193de9cb619247841d0d50e3db0e076666ef3ebd2b0ef1e836de7fe7a71cbe9cb8a7866cb42bc6d78a87f8309e25b32dc43
7
+ data.tar.gz: 0341d3df4cc73b743017744999de3f3a12c9f0ec8b58d99ea425c3e60fa41bae2aab6827228a1c54ba0aa00f12fb470cc500af810f8afdacdbe2634b8a5dda69
@@ -28,10 +28,10 @@ jobs:
28
28
  with:
29
29
  bundler-cache: true
30
30
  - run: bin/rubocop
31
- yarn-audit:
32
- name: Yarn Audit
31
+ npm-audit:
32
+ name: npm Audit
33
33
  runs-on: ubuntu-latest
34
34
  steps:
35
35
  - uses: actions/checkout@v4
36
36
  - uses: actions/setup-node@v4
37
- - run: yarn audit
37
+ - run: npm audit
data/.prettierignore ADDED
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ vendor
data/.rubocop.yml CHANGED
@@ -1,8 +1,124 @@
1
- inherit_gem:
2
- rubocop-rails-omakase: rubocop.yml
3
-
4
- Layout/SpaceInsideArrayLiteralBrackets:
1
+ ---
2
+ AllCops:
3
+ Exclude:
4
+ - "*/node_modules/**/*"
5
+ - "*/vendor/**/*"
6
+ - node_modules/**/*
7
+ - vendor/**/*
8
+ NewCops: enable
9
+ Layout/ClosingHeredocIndentation:
10
+ Enabled: false
11
+ Layout/FirstArgumentIndentation:
12
+ Enabled: false
13
+ Layout/HashAlignment:
14
+ Enabled: false
15
+ Layout/HeredocIndentation:
16
+ Enabled: false
17
+ Layout/LineEndStringConcatenationIndentation:
18
+ Enabled: false
19
+ Layout/LineLength:
20
+ Enabled: false
21
+ Layout/MultilineMethodCallIndentation:
22
+ Enabled: false
23
+ Layout/MultilineOperationIndentation:
24
+ Enabled: false
25
+ Lint/EmptyClass:
26
+ Enabled: false
27
+ Lint/MissingSuper:
28
+ Enabled: false
29
+ Lint/PercentStringArray:
30
+ Enabled: false
31
+ Lint/ShadowingOuterLocalVariable:
32
+ Enabled: false
33
+ Lint/SuppressedException:
34
+ Enabled: false
35
+ Lint/UnusedBlockArgument:
36
+ Enabled: false
37
+ Lint/UselessAssignment:
38
+ Enabled: false
39
+ Metrics/AbcSize:
40
+ Enabled: false
41
+ Metrics/BlockLength:
42
+ Enabled: false
43
+ Metrics/ClassLength:
44
+ Enabled: false
45
+ Metrics/CyclomaticComplexity:
46
+ Enabled: false
47
+ Metrics/MethodLength:
48
+ Enabled: false
49
+ Metrics/ModuleLength:
50
+ Enabled: false
51
+ Metrics/ParameterLists:
52
+ Enabled: false
53
+ Metrics/PerceivedComplexity:
54
+ Enabled: false
55
+ Naming/FileName:
56
+ Enabled: false
57
+ Naming/MethodParameterName:
58
+ Enabled: false
59
+ Naming/VariableNumber:
5
60
  Enabled: false
6
-
7
61
  Performance/UnfreezeString:
8
62
  Enabled: false
63
+ RSpec/AnyInstance:
64
+ Enabled: false
65
+ RSpec/ContextWording:
66
+ Enabled: false
67
+ RSpec/DescribeClass:
68
+ Enabled: false
69
+ RSpec/ExampleLength:
70
+ Enabled: false
71
+ RSpec/ExampleWording:
72
+ Enabled: false
73
+ RSpec/MultipleExpectations:
74
+ Enabled: false
75
+ RSpec/NoExpectationExample:
76
+ Enabled: false
77
+ RSpec/PendingWithoutReason:
78
+ Enabled: false
79
+ Rails/Delegate:
80
+ Enabled: false
81
+ Rails/DynamicFindBy:
82
+ Enabled: false
83
+ Rails/HelperInstanceVariable:
84
+ Enabled: false
85
+ Rails/NegateInclude:
86
+ Enabled: false
87
+ Rails/Output:
88
+ Enabled: false
89
+ Rails/Presence:
90
+ Enabled: false
91
+ Rails/Present:
92
+ Enabled: false
93
+ Rails/ThreeStateBooleanColumn:
94
+ Enabled: false
95
+ Rails/TimeZone:
96
+ Enabled: false
97
+ Security/Eval:
98
+ Enabled: false
99
+ Style/CaseEquality:
100
+ Enabled: false
101
+ Style/Documentation:
102
+ Enabled: false
103
+ Style/DoubleNegation:
104
+ Enabled: false
105
+ Style/EmptyMethod:
106
+ Enabled: false
107
+ Style/IfUnlessModifier:
108
+ Enabled: false
109
+ Style/MultilineBlockChain:
110
+ Enabled: false
111
+ Style/QuotedSymbols:
112
+ Enabled: false
113
+ Style/StringLiterals:
114
+ Enabled: false
115
+ Style/StringLiteralsInInterpolation:
116
+ Enabled: false
117
+ require:
118
+ - rubocop-factory_bot
119
+ - rubocop-performance
120
+ - rubocop-rails
121
+ - rubocop-rake
122
+ - rubocop-rspec
123
+ - rubocop-rspec_rails
124
+ - rubocop-capybara
data/Gemfile CHANGED
@@ -9,5 +9,13 @@ ruby "3.3.4"
9
9
  gem "bundler-audit"
10
10
  gem "rake"
11
11
  gem "rspec"
12
- gem "rubocop-rails-omakase"
13
12
  gem "ruby-prof"
13
+
14
+ gem "rubocop-factory_bot"
15
+ gem "rubocop-performance"
16
+ gem "rubocop-rails"
17
+ gem "rubocop-rake"
18
+ gem "rubocop-rspec"
19
+ gem "rubocop-rspec_rails"
20
+
21
+ gem "rubocop-capybara"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- code-ruby (0.15.16)
4
+ code-ruby (1.1.0)
5
5
  activesupport
6
6
  bigdecimal
7
7
  did-you-mean
@@ -13,7 +13,7 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- activesupport (7.2.0)
16
+ activesupport (7.2.1)
17
17
  base64
18
18
  bigdecimal
19
19
  concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -27,7 +27,7 @@ GEM
27
27
  ast (2.4.2)
28
28
  base64 (0.2.0)
29
29
  bigdecimal (3.1.8)
30
- bundler-audit (0.9.1)
30
+ bundler-audit (0.9.2)
31
31
  bundler (>= 1.2.0, < 3)
32
32
  thor (~> 1.0)
33
33
  concurrent-ruby (1.3.4)
@@ -35,16 +35,14 @@ GEM
35
35
  did-you-mean (0.1.1)
36
36
  levenshtein (>= 0.2.0)
37
37
  diff-lcs (1.5.1)
38
- dorian-arguments (0.3.0)
39
- activesupport
38
+ dorian-arguments (1.1.1)
40
39
  bigdecimal
41
- dorian-to_struct
42
- dorian-to_struct (0.5.0)
43
40
  drb (2.2.1)
44
41
  i18n (1.14.5)
45
42
  concurrent-ruby (~> 1.0)
46
43
  json (2.7.2)
47
- language-ruby (0.9.2)
44
+ language-ruby (1.0.1)
45
+ dorian-arguments
48
46
  zeitwerk
49
47
  language_server-protocol (3.17.0.3)
50
48
  levenshtein (0.2.2)
@@ -59,7 +57,7 @@ GEM
59
57
  rainbow (3.1.1)
60
58
  rake (13.2.1)
61
59
  regexp_parser (2.9.2)
62
- rexml (3.3.5)
60
+ rexml (3.3.6)
63
61
  strscan
64
62
  rspec (3.13.0)
65
63
  rspec-core (~> 3.13.0)
@@ -87,27 +85,30 @@ GEM
87
85
  unicode-display_width (>= 2.4.0, < 3.0)
88
86
  rubocop-ast (1.32.1)
89
87
  parser (>= 3.3.1.0)
90
- rubocop-minitest (0.35.1)
91
- rubocop (>= 1.61, < 2.0)
92
- rubocop-ast (>= 1.31.1, < 2.0)
88
+ rubocop-capybara (2.21.0)
89
+ rubocop (~> 1.41)
90
+ rubocop-factory_bot (2.26.1)
91
+ rubocop (~> 1.61)
93
92
  rubocop-performance (1.21.1)
94
93
  rubocop (>= 1.48.1, < 2.0)
95
94
  rubocop-ast (>= 1.31.1, < 2.0)
96
- rubocop-rails (2.25.1)
95
+ rubocop-rails (2.26.0)
97
96
  activesupport (>= 4.2.0)
98
97
  rack (>= 1.1)
99
- rubocop (>= 1.33.0, < 2.0)
98
+ rubocop (>= 1.52.0, < 2.0)
100
99
  rubocop-ast (>= 1.31.1, < 2.0)
101
- rubocop-rails-omakase (1.0.0)
102
- rubocop
103
- rubocop-minitest
104
- rubocop-performance
105
- rubocop-rails
100
+ rubocop-rake (0.6.0)
101
+ rubocop (~> 1.0)
102
+ rubocop-rspec (3.0.4)
103
+ rubocop (~> 1.61)
104
+ rubocop-rspec_rails (2.30.0)
105
+ rubocop (~> 1.61)
106
+ rubocop-rspec (~> 3, >= 3.0.1)
106
107
  ruby-prof (1.7.0)
107
108
  ruby-progressbar (1.13.0)
108
109
  securerandom (0.3.1)
109
110
  strscan (3.1.0)
110
- thor (1.3.1)
111
+ thor (1.3.2)
111
112
  tzinfo (2.0.6)
112
113
  concurrent-ruby (~> 1.0)
113
114
  unicode-display_width (2.5.0)
@@ -116,17 +117,24 @@ GEM
116
117
  PLATFORMS
117
118
  arm64-darwin-23
118
119
  ruby
120
+ x86_64-linux
119
121
 
120
122
  DEPENDENCIES
121
123
  bundler-audit
122
124
  code-ruby!
123
125
  rake
124
126
  rspec
125
- rubocop-rails-omakase
127
+ rubocop-capybara
128
+ rubocop-factory_bot
129
+ rubocop-performance
130
+ rubocop-rails
131
+ rubocop-rake
132
+ rubocop-rspec
133
+ rubocop-rspec_rails
126
134
  ruby-prof
127
135
 
128
136
  RUBY VERSION
129
137
  ruby 3.3.4p94
130
138
 
131
139
  BUNDLED WITH
132
- 2.5.17
140
+ 2.5.18
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.15.16
1
+ 1.1.0
data/bin/bundle ADDED
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m =
14
+ Module.new do
15
+ module_function
16
+
17
+ def invoked_as_script?
18
+ File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)
19
+ end
20
+
21
+ def env_var_version
22
+ ENV.fetch("BUNDLER_VERSION", nil)
23
+ end
24
+
25
+ def cli_arg_version
26
+ return unless invoked_as_script? # don't want to hijack other binstubs
27
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
28
+
29
+ bundler_version = nil
30
+ update_index = nil
31
+ ARGV.each_with_index do |a, i|
32
+ if update_index && update_index.succ == i &&
33
+ a.match?(Gem::Version::ANCHORED_VERSION_PATTERN)
34
+ bundler_version = a
35
+ end
36
+ unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/o
37
+ next
38
+ end
39
+
40
+ bundler_version = Regexp.last_match(1)
41
+ update_index = i
42
+ end
43
+ bundler_version
44
+ end
45
+
46
+ def gemfile
47
+ gemfile = ENV.fetch("BUNDLE_GEMFILE", nil)
48
+ return gemfile if gemfile && !gemfile.empty?
49
+
50
+ File.expand_path("../Gemfile", __dir__)
51
+ end
52
+
53
+ def lockfile
54
+ lockfile =
55
+ case File.basename(gemfile)
56
+ when "gems.rb"
57
+ gemfile.sub(/\.rb$/, ".locked")
58
+ else
59
+ "#{gemfile}.lock"
60
+ end
61
+ File.expand_path(lockfile)
62
+ end
63
+
64
+ def lockfile_version
65
+ return unless File.file?(lockfile)
66
+
67
+ lockfile_contents = File.read(lockfile)
68
+ unless lockfile_contents =~
69
+ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/o
70
+ return
71
+ end
72
+
73
+ Regexp.last_match(1)
74
+ end
75
+
76
+ def bundler_requirement
77
+ @bundler_requirement ||=
78
+ env_var_version || cli_arg_version ||
79
+ bundler_requirement_for(lockfile_version)
80
+ end
81
+
82
+ def bundler_requirement_for(version)
83
+ return "#{Gem::Requirement.default}.a" unless version
84
+
85
+ bundler_gem_version = Gem::Version.new(version)
86
+
87
+ bundler_gem_version.approximate_recommendation
88
+ end
89
+
90
+ def load_bundler!
91
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
92
+
93
+ activate_bundler
94
+ end
95
+
96
+ def activate_bundler
97
+ gem_error =
98
+ activation_error_handling { gem "bundler", bundler_requirement }
99
+ return if gem_error.nil?
100
+
101
+ require_error = activation_error_handling { require "bundler/version" }
102
+ if require_error.nil? &&
103
+ Gem::Requirement.new(bundler_requirement).satisfied_by?(
104
+ Gem::Version.new(Bundler::VERSION)
105
+ )
106
+ return
107
+ end
108
+
109
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
110
+ exit 42
111
+ end
112
+
113
+ def activation_error_handling
114
+ yield
115
+ nil
116
+ rescue StandardError, LoadError => e
117
+ e
118
+ end
119
+ end
120
+
121
+ m.load_bundler!
122
+
123
+ load Gem.bin_path("bundler", "bundle") if m.invoked_as_script?
data/bin/code CHANGED
@@ -34,12 +34,10 @@ abort Code::Version.to_s if parsed.options.version
34
34
  abort parsed.help if parsed.options.help
35
35
 
36
36
  input = parsed.options.input.to_s
37
- input = File.read(input) if File.exist?(input)
37
+ input += File.read(input) if File.exist?(input)
38
38
  input += parsed.arguments.join(" ")
39
39
  input += parsed.files.map { |file| File.read(file) }.join
40
40
 
41
- abort parsed.help if input.empty?
42
-
43
41
  profile = parsed.options.profile || parsed.options.profiler
44
42
  require "ruby-prof" if profile
45
43
 
@@ -61,11 +59,11 @@ end
61
59
  if profile
62
60
  result = RubyProf.stop
63
61
 
64
- if parsed.options.profiler == "html"
65
- printer = RubyProf::GraphHtmlPrinter.new(result)
66
- printer.print($stdout)
67
- else
68
- printer = RubyProf::FlatPrinter.new(result)
69
- printer.print($stdout)
70
- end
62
+ printer =
63
+ if parsed.options.profiler == "html"
64
+ RubyProf::GraphHtmlPrinter.new(result)
65
+ else
66
+ RubyProf::FlatPrinter.new(result)
67
+ end
68
+ printer.print($stdout)
71
69
  end
data/code-ruby.gemspec CHANGED
@@ -16,8 +16,10 @@ Gem::Specification.new do |s|
16
16
  s.add_dependency "activesupport"
17
17
  s.add_dependency "bigdecimal"
18
18
  s.add_dependency "did-you-mean"
19
+ s.add_dependency "dorian-arguments"
19
20
  s.add_dependency "json"
20
21
  s.add_dependency "language-ruby"
21
22
  s.add_dependency "zeitwerk"
22
- s.add_dependency "dorian-arguments"
23
+ s.metadata["rubygems_mfa_required"] = "true"
24
+ s.required_ruby_version = "3.3.4"
23
25
  end
@@ -41,9 +41,7 @@ class Code
41
41
 
42
42
  def evaluate(**args)
43
43
  ::Code::Object::Dictionary.new(
44
- (@key_values || [])
45
- .map { |key_value| key_value.evaluate(**args) }
46
- .to_h
44
+ (@key_values || []).to_h { |key_value| key_value.evaluate(**args) }
47
45
  )
48
46
  end
49
47
  end
data/lib/code/node/if.rb CHANGED
@@ -35,24 +35,29 @@ class Code
35
35
  end
36
36
 
37
37
  def evaluate(**args)
38
- if @first_operator == IF_KEYWORD &&
39
- @first_statement.evaluate(**args).truthy?
40
- @first_body.evaluate(**args)
41
- elsif @first_operator == UNLESS_KEYWORD &&
42
- @first_statement.evaluate(**args).falsy?
38
+ if (
39
+ @first_operator == IF_KEYWORD &&
40
+ @first_statement.evaluate(**args).truthy?
41
+ ) ||
42
+ (
43
+ @first_operator == UNLESS_KEYWORD &&
44
+ @first_statement.evaluate(**args).falsy?
45
+ )
43
46
  @first_body.evaluate(**args)
44
47
  else
45
48
  (@elses || []).each do |elses|
46
- if elses.operator == ELSIF_KEYWORD &&
47
- elses.statement.evaluate(**args).truthy?
48
- return elses.body.evaluate(**args)
49
- elsif elses.operator == IF_KEYWORD &&
50
- elses.statement.evaluate(**args).truthy?
51
- return elses.body.evaluate(**args)
52
- elsif elses.operator == UNLESS_KEYWORD &&
53
- elses.statement.evaluate(**args).falsy?
54
- return elses.body.evaluate(**args)
55
- elsif elses.operator == ELSE_KEYWORD
49
+ if (
50
+ elses.operator == ELSIF_KEYWORD &&
51
+ elses.statement.evaluate(**args).truthy?
52
+ ) ||
53
+ (
54
+ elses.operator == IF_KEYWORD &&
55
+ elses.statement.evaluate(**args).truthy?
56
+ ) ||
57
+ (
58
+ elses.operator == UNLESS_KEYWORD &&
59
+ elses.statement.evaluate(**args).falsy?
60
+ ) || (elses.operator == ELSE_KEYWORD)
56
61
  return elses.body.evaluate(**args)
57
62
  end
58
63
  end
@@ -58,9 +58,7 @@ class Code
58
58
  else
59
59
  right.statement.evaluate(**args, object: left)
60
60
  end
61
- elsif right.or? && left.truthy?
62
- left
63
- elsif right.and? && left.falsy?
61
+ elsif (right.or? && left.truthy?) || (right.and? && left.falsy?)
64
62
  left
65
63
  else
66
64
  left.call(
@@ -30,17 +30,17 @@ class Code
30
30
  when "while"
31
31
  left = Object::Nothing.new
32
32
 
33
- while (@right&.evaluate(**args) || Object::Nothing.new).truthy?
34
- left = @left&.evaluate(**args) || Object::Nothing.new
35
- end
33
+ left = @left&.evaluate(**args) || Object::Nothing.new while (
34
+ @right&.evaluate(**args) || Object::Nothing.new
35
+ ).truthy?
36
36
 
37
37
  left
38
38
  when "until"
39
39
  left = Object::Nothing.new
40
40
 
41
- while (@right&.evaluate(**args) || Object::Nothing.new).falsy?
42
- left = @left&.evaluate(**args) || Object::Nothing.new
43
- end
41
+ left = @left&.evaluate(**args) || Object::Nothing.new while (
42
+ @right&.evaluate(**args) || Object::Nothing.new
43
+ ).falsy?
44
44
 
45
45
  left
46
46
  when "rescue"
@@ -22,17 +22,17 @@ class Code
22
22
  when WHILE_KEYWORD
23
23
  last = Object::Nothing.new
24
24
 
25
- while (@statement&.evaluate(**args) || Object::Nothing.new).truthy?
26
- last = @body&.evaluate(**args) || Object::Nothing.new
27
- end
25
+ last = @body&.evaluate(**args) || Object::Nothing.new while (
26
+ @statement&.evaluate(**args) || Object::Nothing.new
27
+ ).truthy?
28
28
 
29
29
  last
30
30
  when UNTIL_KEYWORD
31
31
  last = Object::Nothing.new
32
32
 
33
- while (@statement&.evaluate(**args) || Object::Nothing.new).falsy?
34
- last = @body&.evaluate(**args) || Object::Nothing.new
35
- end
33
+ last = @body&.evaluate(**args) || Object::Nothing.new while (
34
+ @statement&.evaluate(**args) || Object::Nothing.new
35
+ ).falsy?
36
36
 
37
37
  last
38
38
  when LOOP_KEYWORD
@@ -3,7 +3,7 @@
3
3
  class Code
4
4
  class Object
5
5
  class Boolean < ::Code::Object
6
- def initialize(*args, **_kargs, &_block)
6
+ def initialize(*args, **_kargs, &)
7
7
  raw = args.first || Nothing.new
8
8
  raw = raw.raw if raw.is_a?(Object)
9
9
  @raw = !!raw
@@ -3,7 +3,7 @@
3
3
  class Code
4
4
  class Object
5
5
  class Class < Object
6
- def initialize(*args, **_kargs, &_block)
6
+ def initialize(*args, **_kargs, &)
7
7
  raw = args.first || Nothing.new
8
8
  raw = raw.raw if raw.is_a?(Class)
9
9
  raw = raw.class if raw.is_an?(Object)
@@ -3,7 +3,7 @@
3
3
  class Code
4
4
  class Object
5
5
  class Code < Object
6
- def initialize(*args, **_kargs, &_block)
6
+ def initialize(*args, **_kargs, &)
7
7
  raw = args.first.presence || Nothing.new
8
8
  @raw = raw.is_a?(Node) ? raw : Node::Code.new(::Code.parse(raw.to_s))
9
9
  end
@@ -5,7 +5,7 @@ class Code
5
5
  class Context < Dictionary
6
6
  attr_reader :parent
7
7
 
8
- def initialize(*args, **_kargs, &_block)
8
+ def initialize(*args, **_kargs, &)
9
9
  raw = args.first || Dictionary.new
10
10
  raw = raw.raw if raw.is_a?(Object)
11
11
  @raw = raw.to_h
@@ -3,7 +3,7 @@
3
3
  class Code
4
4
  class Object
5
5
  class Date < Object
6
- def initialize(*args, **_kargs, &_block)
6
+ def initialize(*args, **_kargs, &)
7
7
  raw = args.map(&:to_s).join("-").presence || ::Date.current.to_s
8
8
  @raw = ::Date.parse(raw)
9
9
  rescue ::Date::Error
@@ -3,12 +3,12 @@
3
3
  class Code
4
4
  class Object
5
5
  class Decimal < Object
6
- def initialize(*args, **_kargs, &_block)
6
+ def initialize(*args, **_kargs, &)
7
7
  decimal = args.first || "0"
8
8
  exponent = args.second || "0"
9
9
  decimal = decimal.raw if decimal.is_an?(Object)
10
10
  exponent = exponent.raw if exponent.is_an?(Object)
11
- @raw = decimal.to_d * 10**exponent.to_d
11
+ @raw = decimal.to_d * (10**exponent.to_d)
12
12
  rescue FloatDomainError
13
13
  raise Error, "#{decimal.inspect} * 10**#{exponent.inspect} is invalid"
14
14
  end