code-ruby 5.0.2 → 5.0.3
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/code +2 -2
- data/lib/code/concerns/shared.rb +3 -3
- data/lib/code/object/boolean.rb +1 -1
- data/lib/code/object/class.rb +3 -3
- data/lib/code/object/code.rb +1 -1
- data/lib/code/object/context.rb +14 -1
- data/lib/code/object/date.rb +1 -1
- data/lib/code/object/decimal.rb +1 -1
- data/lib/code/object/dictionary.rb +3 -3
- data/lib/code/object/duration.rb +1 -1
- data/lib/code/object/html.rb +1 -1
- data/lib/code/object/integer.rb +1 -1
- data/lib/code/object/list.rb +1 -1
- data/lib/code/object/nothing.rb +1 -1
- data/lib/code/object/range.rb +1 -1
- data/lib/code/object/regex.rb +7 -8
- data/lib/code/object/string.rb +1 -1
- data/lib/code/object/time.rb +1 -1
- data/lib/code/object/url.rb +1 -1
- data/lib/code/object.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6c19839210f13057cf11e83849e691bfa59fc63720891af5feef70afebe4d15a
|
|
4
|
+
data.tar.gz: 9f3376a950170b7208b062a3f29a1642da5e80169dbed83c3bcab099ebc3ad7c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ed16c6eddc5904d2fb8b95074f5ae1c2a445f1e1602efab82ac536348749ec7b3f6cfa907d88997b0b6ec9d7c72f886ad441734656f2d1edd7aaf3b4d64dbfc7
|
|
7
|
+
data.tar.gz: b214393a66a7d700b7be24b3fab4b8555be1e870f45dcf9b0b034c2bff67b62e4c5cae068f0539e490d4bfc37e32ddd94742653ddcb2bc88bcf4fcfd302480ed
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.0.
|
|
1
|
+
5.0.3
|
data/bin/code
CHANGED
data/lib/code/concerns/shared.rb
CHANGED
|
@@ -297,7 +297,7 @@ class Code
|
|
|
297
297
|
|
|
298
298
|
if code_operator.to_s == "="
|
|
299
299
|
code_context = args.fetch(:context)
|
|
300
|
-
code_context.
|
|
300
|
+
code_context.code_assign(self, code_value)
|
|
301
301
|
elsif setter_operator?(code_operator)
|
|
302
302
|
code_dynamic_functions.code_set(code_operator.to_s.chop, code_value)
|
|
303
303
|
return code_value
|
|
@@ -441,8 +441,8 @@ class Code
|
|
|
441
441
|
keys.to_h { |key| [key, hash.fetch(key)] }
|
|
442
442
|
end
|
|
443
443
|
|
|
444
|
-
def sig(args, &
|
|
445
|
-
Type::Sig.sig(args, object: self, &
|
|
444
|
+
def sig(args, &)
|
|
445
|
+
Type::Sig.sig(args, object: self, &)
|
|
446
446
|
|
|
447
447
|
Object::Nothing.new
|
|
448
448
|
end
|
data/lib/code/object/boolean.rb
CHANGED
data/lib/code/object/class.rb
CHANGED
|
@@ -76,7 +76,7 @@ class Code
|
|
|
76
76
|
{}
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
def initialize(*args, **_kargs, &
|
|
79
|
+
def initialize(*args, **_kargs, &)
|
|
80
80
|
self.raw =
|
|
81
81
|
if args.first.is_a?(Class)
|
|
82
82
|
args.first.raw
|
|
@@ -124,8 +124,8 @@ class Code
|
|
|
124
124
|
end
|
|
125
125
|
end
|
|
126
126
|
|
|
127
|
-
def code_call(
|
|
128
|
-
raw.code_new(*
|
|
127
|
+
def code_call(*, **_globals)
|
|
128
|
+
raw.code_new(*)
|
|
129
129
|
end
|
|
130
130
|
|
|
131
131
|
def code_extend(function)
|
data/lib/code/object/code.rb
CHANGED
data/lib/code/object/context.rb
CHANGED
|
@@ -34,7 +34,7 @@ class Code
|
|
|
34
34
|
|
|
35
35
|
attr_accessor :parent
|
|
36
36
|
|
|
37
|
-
def initialize(*args, **_kargs, &
|
|
37
|
+
def initialize(*args, **_kargs, &)
|
|
38
38
|
super(args.first)
|
|
39
39
|
@parent = args.second if args.second.is_a?(Dictionary)
|
|
40
40
|
end
|
|
@@ -63,6 +63,19 @@ class Code
|
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
+
def code_assign(identifier, value)
|
|
67
|
+
code_identifier = identifier.to_code
|
|
68
|
+
context = self
|
|
69
|
+
|
|
70
|
+
context = context.parent while context.parent? && context.code_has_key?(code_identifier).falsy?
|
|
71
|
+
|
|
72
|
+
if context.code_has_key?(code_identifier).falsy?
|
|
73
|
+
context = self
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
context.code_set(code_identifier, value)
|
|
77
|
+
end
|
|
78
|
+
|
|
66
79
|
def merge(other)
|
|
67
80
|
Context.new(raw.merge(other.raw), parent || other.parent)
|
|
68
81
|
end
|
data/lib/code/object/date.rb
CHANGED
data/lib/code/object/decimal.rb
CHANGED
|
@@ -1634,7 +1634,7 @@ class Code
|
|
|
1634
1634
|
to: :code_size
|
|
1635
1635
|
)
|
|
1636
1636
|
|
|
1637
|
-
def initialize(*args, **kargs, &
|
|
1637
|
+
def initialize(*args, **kargs, &)
|
|
1638
1638
|
self.raw =
|
|
1639
1639
|
args
|
|
1640
1640
|
.map do |arg|
|
|
@@ -2681,8 +2681,8 @@ class Code
|
|
|
2681
2681
|
e.code_value
|
|
2682
2682
|
end
|
|
2683
2683
|
|
|
2684
|
-
def code_update(
|
|
2685
|
-
code_merge!(
|
|
2684
|
+
def code_update(*, **globals)
|
|
2685
|
+
code_merge!(*, **globals)
|
|
2686
2686
|
end
|
|
2687
2687
|
|
|
2688
2688
|
def code_replace(dictionary)
|
data/lib/code/object/duration.rb
CHANGED
data/lib/code/object/html.rb
CHANGED
data/lib/code/object/integer.rb
CHANGED
data/lib/code/object/list.rb
CHANGED
data/lib/code/object/nothing.rb
CHANGED
data/lib/code/object/range.rb
CHANGED
|
@@ -241,7 +241,7 @@ class Code
|
|
|
241
241
|
|
|
242
242
|
attr_reader :code_left, :code_right, :code_options, :code_exclude_end
|
|
243
243
|
|
|
244
|
-
def initialize(*args, **kargs, &
|
|
244
|
+
def initialize(*args, **kargs, &)
|
|
245
245
|
if args.first.is_a?(Range)
|
|
246
246
|
@code_left = args.first.code_left
|
|
247
247
|
@code_right = args.first.code_right
|
data/lib/code/object/regex.rb
CHANGED
|
@@ -101,7 +101,7 @@ class Code
|
|
|
101
101
|
{}
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
-
def initialize(*args, **kargs, &
|
|
104
|
+
def initialize(*args, **kargs, &)
|
|
105
105
|
raise Error, "Regex.new: pattern is required" if args.empty?
|
|
106
106
|
raise Error, "Regex.new: expected 1-2 arguments" if args.size > 2
|
|
107
107
|
|
|
@@ -195,30 +195,30 @@ class Code
|
|
|
195
195
|
|
|
196
196
|
def code_options
|
|
197
197
|
Dictionary.new(
|
|
198
|
-
OPTION_FLAGS.transform_values { |flag|
|
|
198
|
+
OPTION_FLAGS.transform_values { |flag| raw.options.allbits?(flag) }
|
|
199
199
|
)
|
|
200
200
|
end
|
|
201
201
|
|
|
202
202
|
def code_ignore_case?
|
|
203
|
-
Boolean.new(
|
|
203
|
+
Boolean.new(raw.options.allbits?(::Regexp::IGNORECASE))
|
|
204
204
|
end
|
|
205
205
|
|
|
206
206
|
def code_extended?
|
|
207
|
-
Boolean.new(
|
|
207
|
+
Boolean.new(raw.options.allbits?(::Regexp::EXTENDED))
|
|
208
208
|
end
|
|
209
209
|
|
|
210
210
|
def code_multiple_lines?
|
|
211
|
-
Boolean.new(
|
|
211
|
+
Boolean.new(raw.options.allbits?(::Regexp::MULTILINE))
|
|
212
212
|
end
|
|
213
213
|
|
|
214
214
|
def code_fixed_encoding?
|
|
215
215
|
Boolean.new(
|
|
216
|
-
|
|
216
|
+
raw.options.allbits?(::Regexp::FIXEDENCODING)
|
|
217
217
|
)
|
|
218
218
|
end
|
|
219
219
|
|
|
220
220
|
def code_no_encoding?
|
|
221
|
-
Boolean.new(
|
|
221
|
+
Boolean.new(raw.options.allbits?(::Regexp::NOENCODING))
|
|
222
222
|
end
|
|
223
223
|
|
|
224
224
|
def code_to_string
|
|
@@ -228,7 +228,6 @@ class Code
|
|
|
228
228
|
def code_inspect
|
|
229
229
|
String.new(raw.inspect)
|
|
230
230
|
end
|
|
231
|
-
|
|
232
231
|
end
|
|
233
232
|
end
|
|
234
233
|
end
|
data/lib/code/object/string.rb
CHANGED
data/lib/code/object/time.rb
CHANGED
data/lib/code/object/url.rb
CHANGED
data/lib/code/object.rb
CHANGED
|
@@ -562,8 +562,8 @@ class Code
|
|
|
562
562
|
Type::Or.new(self, other)
|
|
563
563
|
end
|
|
564
564
|
|
|
565
|
-
def self.code_new(*
|
|
566
|
-
new(*
|
|
565
|
+
def self.code_new(*)
|
|
566
|
+
new(*)
|
|
567
567
|
end
|
|
568
568
|
|
|
569
569
|
def self.functions
|
|
@@ -620,8 +620,8 @@ class Code
|
|
|
620
620
|
self.class.name
|
|
621
621
|
end
|
|
622
622
|
|
|
623
|
-
def code_new(*
|
|
624
|
-
self.class.code_new(*
|
|
623
|
+
def code_new(*)
|
|
624
|
+
self.class.code_new(*)
|
|
625
625
|
end
|
|
626
626
|
end
|
|
627
627
|
end
|