code-ruby 1.5.7 → 1.6.1
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/.rubocop.yml +2 -0
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/docs/precedence.txt +36 -0
- data/lib/code/node/if.rb +5 -0
- data/lib/code/object/date.rb +670 -46
- data/lib/code/object/decimal.rb +722 -78
- data/lib/code/object/dictionary.rb +415 -44
- data/lib/code/object/global.rb +8 -1
- data/lib/code/object/http.rb +1 -1
- data/lib/code/object/integer.rb +724 -87
- data/lib/code/object/list.rb +545 -101
- data/lib/code/object/number.rb +8 -0
- data/lib/code/object/parameter.rb +7 -11
- data/lib/code/object/range.rb +5 -0
- data/lib/code/object/string.rb +7 -0
- data/lib/code/object/time.rb +647 -116
- data/lib/code/parser/equal.rb +1 -1
- data/lib/code/parser/equality.rb +1 -1
- data/lib/code/parser/if.rb +7 -2
- data/lib/code/parser/name.rb +41 -6
- data/lib/code.rb +1 -1
- data/spec/code/object/decimal_spec.rb +0 -1
- data/spec/code/object/http_spec.rb +72 -68
- data/spec/code/object/integer_spec.rb +0 -1
- data/spec/code/parser/if_modifier_spec.rb +2 -2
- data/spec/code_spec.rb +3 -2
- metadata +4 -2
@@ -2,29 +2,25 @@
|
|
2
2
|
|
3
3
|
class Code
|
4
4
|
class Object
|
5
|
-
class Parameter <
|
6
|
-
def initialize(*args, **_kargs, &_block)
|
7
|
-
self.raw = Dictionary.new(args.first)
|
8
|
-
end
|
9
|
-
|
5
|
+
class Parameter < Dictionary
|
10
6
|
def code_name
|
11
|
-
String.new(
|
7
|
+
String.new(code_get(:name))
|
12
8
|
end
|
13
9
|
|
14
10
|
def code_regular?
|
15
|
-
Boolean.new(
|
11
|
+
Boolean.new(code_get(:regular?))
|
16
12
|
end
|
17
13
|
|
18
14
|
def code_keyword?
|
19
|
-
Boolean.new(
|
15
|
+
Boolean.new(code_get(:keyword?))
|
20
16
|
end
|
21
17
|
|
22
18
|
def code_regular_splat?
|
23
|
-
Boolean.new(
|
19
|
+
Boolean.new(code_get(:regular_splat?))
|
24
20
|
end
|
25
21
|
|
26
22
|
def code_keyword_splat?
|
27
|
-
Boolean.new(
|
23
|
+
Boolean.new(code_get(:keyword_splat?))
|
28
24
|
end
|
29
25
|
|
30
26
|
def code_required?
|
@@ -36,7 +32,7 @@ class Code
|
|
36
32
|
end
|
37
33
|
|
38
34
|
def code_default
|
39
|
-
|
35
|
+
code_get(:default).to_code
|
40
36
|
end
|
41
37
|
|
42
38
|
def code_evaluate(...)
|
data/lib/code/object/range.rb
CHANGED
@@ -11,6 +11,11 @@ class Code
|
|
11
11
|
@code_right = args.first.code_right
|
12
12
|
@code_options = args.first.code_options
|
13
13
|
@code_exclude_end = args.first.code_exclude_end
|
14
|
+
elsif args.first.is_a?(List)
|
15
|
+
@code_left = args.first.code_first
|
16
|
+
@code_right = args.first.code_last
|
17
|
+
@code_options = Dictionary.new(args.second.presence || kargs)
|
18
|
+
@code_exclude_end = Boolean.new(code_options.code_get(:exclude_end))
|
14
19
|
else
|
15
20
|
@code_left =
|
16
21
|
(args.first.to_code.nothing? ? Integer.new(0) : args.first.to_code)
|
data/lib/code/object/string.rb
CHANGED
@@ -55,6 +55,9 @@ class Code
|
|
55
55
|
when "upcase"
|
56
56
|
sig(args)
|
57
57
|
code_upcase
|
58
|
+
when "size"
|
59
|
+
sig(args)
|
60
|
+
code_size
|
58
61
|
else
|
59
62
|
super
|
60
63
|
end
|
@@ -111,6 +114,10 @@ class Code
|
|
111
114
|
code_n = Integer.new(1) if code_n.nothing?
|
112
115
|
String.new(raw.first(code_n.raw))
|
113
116
|
end
|
117
|
+
|
118
|
+
def code_size
|
119
|
+
Integer.new(raw.size)
|
120
|
+
end
|
114
121
|
end
|
115
122
|
end
|
116
123
|
end
|