taipo 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/taipo.rb +0 -86
- data/lib/taipo/cache.rb +2 -1
- data/lib/taipo/check.rb +9 -7
- data/lib/taipo/parser.rb +292 -153
- data/lib/taipo/parser/stack.rb +143 -0
- data/lib/taipo/parser/syntax_state.rb +12 -11
- data/lib/taipo/parser/validater.rb +126 -58
- data/lib/taipo/refinements.rb +30 -0
- data/lib/taipo/type_element.rb +50 -68
- data/lib/taipo/type_element/children.rb +47 -0
- data/lib/taipo/type_element/constraint.rb +11 -15
- data/lib/taipo/type_element/constraints.rb +36 -0
- data/lib/taipo/type_elements.rb +33 -0
- data/lib/taipo/utilities.rb +81 -0
- data/lib/taipo/version.rb +1 -1
- metadata +8 -3
- data/lib/taipo/type_element/child_type.rb +0 -40
data/lib/taipo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taipo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Camilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01
|
11
|
+
date: 2018-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -132,11 +132,16 @@ files:
|
|
132
132
|
- lib/taipo/exceptions/syntax_error.rb
|
133
133
|
- lib/taipo/exceptions/type_error.rb
|
134
134
|
- lib/taipo/parser.rb
|
135
|
+
- lib/taipo/parser/stack.rb
|
135
136
|
- lib/taipo/parser/syntax_state.rb
|
136
137
|
- lib/taipo/parser/validater.rb
|
138
|
+
- lib/taipo/refinements.rb
|
137
139
|
- lib/taipo/type_element.rb
|
138
|
-
- lib/taipo/type_element/
|
140
|
+
- lib/taipo/type_element/children.rb
|
139
141
|
- lib/taipo/type_element/constraint.rb
|
142
|
+
- lib/taipo/type_element/constraints.rb
|
143
|
+
- lib/taipo/type_elements.rb
|
144
|
+
- lib/taipo/utilities.rb
|
140
145
|
- lib/taipo/version.rb
|
141
146
|
- taipo.gemspec
|
142
147
|
homepage: https://github.com/pyrmont/taipo/
|
@@ -1,40 +0,0 @@
|
|
1
|
-
module Taipo
|
2
|
-
class TypeElement
|
3
|
-
|
4
|
-
# A collection of Taipo::TypeElement
|
5
|
-
# @since 1.0.0
|
6
|
-
# @api private
|
7
|
-
class ChildType < Array
|
8
|
-
|
9
|
-
# Initialize a new collection
|
10
|
-
#
|
11
|
-
# @note The +components+ argument is two-dimensional array because the
|
12
|
-
# element returned by an enumerator for a collection can consist of
|
13
|
-
# multiple elements (eg. a Hash, where it consists of two elements).
|
14
|
-
#
|
15
|
-
# @param components [Array<Array<Taipo::TypeElement>>] the components that
|
16
|
-
# will make up the ChildType
|
17
|
-
#
|
18
|
-
# @since 1.0.0
|
19
|
-
# @api private
|
20
|
-
def initialize(components = nil)
|
21
|
-
components.each { |c| self.push c } unless components.nil?
|
22
|
-
end
|
23
|
-
|
24
|
-
# Return the String representation of this ChildType
|
25
|
-
#
|
26
|
-
# @since 1.1.0
|
27
|
-
# @api private
|
28
|
-
def to_s
|
29
|
-
inner = self.reduce(nil) do |memo_e,component|
|
30
|
-
el = component.reduce(nil) do |memo_c,c|
|
31
|
-
(memo_c.nil?) ? c.to_s : memo_c + '|' + c.to_s
|
32
|
-
end
|
33
|
-
(memo_e.nil?) ? el : memo_e + ',' + el
|
34
|
-
end
|
35
|
-
'<' + inner + '>'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|