code-ruby 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
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 +24 -17
  7. data/VERSION +1 -1
  8. data/bin/bundle +123 -0
  9. data/bin/code +9 -11
  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: c8fd1137d78771da7054494333cedcdf9ebb4d45402112d2694d227e4d44739b
4
- data.tar.gz: f494bfe408b64cd08e39f300b499d1634c8ec59534519306658d44ef908c2f72
3
+ metadata.gz: 3d8e0526c2c649cf532eb5247172d32f52800a1006a4381de261faddfe654f04
4
+ data.tar.gz: 0d2397eb058541a4240162524b6896ece6978affc5aa3536928986f20be263b6
5
5
  SHA512:
6
- metadata.gz: 641adcd7f50838888057e7f2c84464d89641a5648136a00f18955ae2128d35b59ac7d2a780544c0a3cf2f917110e7417cbe9dfc4d1f9c494eac80cf313abe2b4
7
- data.tar.gz: d42e4ab20e52db2ab7cbde25b12c43810ef8441076954cbe3fbf7fba6abb1ae861af48ea0b85b85d037e26c77aeb96cc4c6b26a96f42e651ea3e33ee4845ca89
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 (1.0.0)
4
+ code-ruby (1.1.0)
5
5
  activesupport
6
6
  bigdecimal
7
7
  did-you-mean
@@ -35,16 +35,13 @@ 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.4.1)
39
- activesupport
38
+ dorian-arguments (1.1.1)
40
39
  bigdecimal
41
- dorian-to_struct
42
- dorian-to_struct (0.6.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.3)
44
+ language-ruby (1.0.1)
48
45
  dorian-arguments
49
46
  zeitwerk
50
47
  language_server-protocol (3.17.0.3)
@@ -88,9 +85,10 @@ GEM
88
85
  unicode-display_width (>= 2.4.0, < 3.0)
89
86
  rubocop-ast (1.32.1)
90
87
  parser (>= 3.3.1.0)
91
- rubocop-minitest (0.35.1)
92
- rubocop (>= 1.61, < 2.0)
93
- 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)
94
92
  rubocop-performance (1.21.1)
95
93
  rubocop (>= 1.48.1, < 2.0)
96
94
  rubocop-ast (>= 1.31.1, < 2.0)
@@ -99,16 +97,18 @@ GEM
99
97
  rack (>= 1.1)
100
98
  rubocop (>= 1.52.0, < 2.0)
101
99
  rubocop-ast (>= 1.31.1, < 2.0)
102
- rubocop-rails-omakase (1.0.0)
103
- rubocop
104
- rubocop-minitest
105
- rubocop-performance
106
- 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)
107
107
  ruby-prof (1.7.0)
108
108
  ruby-progressbar (1.13.0)
109
109
  securerandom (0.3.1)
110
110
  strscan (3.1.0)
111
- thor (1.3.1)
111
+ thor (1.3.2)
112
112
  tzinfo (2.0.6)
113
113
  concurrent-ruby (~> 1.0)
114
114
  unicode-display_width (2.5.0)
@@ -117,17 +117,24 @@ GEM
117
117
  PLATFORMS
118
118
  arm64-darwin-23
119
119
  ruby
120
+ x86_64-linux
120
121
 
121
122
  DEPENDENCIES
122
123
  bundler-audit
123
124
  code-ruby!
124
125
  rake
125
126
  rspec
126
- 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
127
134
  ruby-prof
128
135
 
129
136
  RUBY VERSION
130
137
  ruby 3.3.4p94
131
138
 
132
139
  BUNDLED WITH
133
- 2.5.17
140
+ 2.5.18
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
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,13 +34,11 @@ 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
- profile = parsed.options.profile || !parsed.options.profiler.empty?
41
+ profile = parsed.options.profile || parsed.options.profiler
44
42
  require "ruby-prof" if profile
45
43
 
46
44
  RubyProf.start if profile
@@ -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