tree_struct 1.0.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.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +50 -0
- data/LICENSE.txt +21 -0
- data/README.md +223 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/tree_struct/array.rb +14 -0
- data/lib/tree_struct/attribute.rb +59 -0
- data/lib/tree_struct/attributes.rb +15 -0
- data/lib/tree_struct/version.rb +3 -0
- data/lib/tree_struct.rb +67 -0
- data/tree_struct.gemspec +40 -0
- metadata +133 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ba7a5b878999f86027b70eca32ec20f4f3061e5f
|
4
|
+
data.tar.gz: 948f42ea822698c5b92ab642be21c419233e60a7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d791041412fc353dffcd70186af5d9309b2d36c1933c6b2fe995f3646ee467ac07a17e72db0b53ad5ca144e892fa9627debe6fdcebe3852d27b7dd413981381a
|
7
|
+
data.tar.gz: 6efbf12c034ee9bbaabcf87c30ac01f9267c65dbb0ff1c936f2401bb9e3ef5e5d717ffc89037b7f8693c8c8de46f4e139971f80eef54006d4bee6dbcf1abd660
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tree_struct (1.0.0)
|
5
|
+
activesupport (>= 3.2)
|
6
|
+
typed_array (>= 1.0.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (5.2.0)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (>= 0.7, < 2)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
concurrent-ruby (1.0.5)
|
17
|
+
diff-lcs (1.3)
|
18
|
+
i18n (1.0.1)
|
19
|
+
concurrent-ruby (~> 1.0)
|
20
|
+
minitest (5.11.3)
|
21
|
+
rake (10.5.0)
|
22
|
+
rspec (3.7.0)
|
23
|
+
rspec-core (~> 3.7.0)
|
24
|
+
rspec-expectations (~> 3.7.0)
|
25
|
+
rspec-mocks (~> 3.7.0)
|
26
|
+
rspec-core (3.7.1)
|
27
|
+
rspec-support (~> 3.7.0)
|
28
|
+
rspec-expectations (3.7.0)
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
+
rspec-support (~> 3.7.0)
|
31
|
+
rspec-mocks (3.7.0)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.7.0)
|
34
|
+
rspec-support (3.7.1)
|
35
|
+
thread_safe (0.3.6)
|
36
|
+
typed_array (1.0.1)
|
37
|
+
tzinfo (1.2.5)
|
38
|
+
thread_safe (~> 0.1)
|
39
|
+
|
40
|
+
PLATFORMS
|
41
|
+
ruby
|
42
|
+
|
43
|
+
DEPENDENCIES
|
44
|
+
bundler (~> 1.16)
|
45
|
+
rake (~> 10.0)
|
46
|
+
rspec (~> 3.0)
|
47
|
+
tree_struct!
|
48
|
+
|
49
|
+
BUNDLED WITH
|
50
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Alexander Koltun
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,223 @@
|
|
1
|
+
# TreeStruct
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tree_struct`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'tree_struct'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install tree_struct
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### Table of Contents
|
26
|
+
|
27
|
+
1. [Definition](#1-definition)
|
28
|
+
1. [Nested TreeStruct](11-nested-tree-struct)
|
29
|
+
2. [Array of TreeStruct](12-array-of-tree-struct)
|
30
|
+
2. [Serialize to Hash](2-serialize-to-hash)
|
31
|
+
1. [Nested TreeStruct](21-nested-tree-struct)
|
32
|
+
2. [Array of TreeStruct](22-array-of-tree-struct)
|
33
|
+
3. [Reference Guide](3-reference-guide-attribute-parameters)
|
34
|
+
|
35
|
+
### 1. Definition
|
36
|
+
|
37
|
+
Inherit your class from `TreeStruct` and define its attributes.
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
class SimpleTreeStruct < TreeStruct
|
41
|
+
attribute :name
|
42
|
+
attribute :year
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
Access attributes via dot notation.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
simple_tree_struct = SimpleTreeStruct.new
|
50
|
+
simple_tree_struct.name = 'Ferrari' # => "Ferrari"
|
51
|
+
simple_tree_struct.year = 1950 # => 1950
|
52
|
+
```
|
53
|
+
|
54
|
+
#### 1.1. Nested TreeStruct Objects
|
55
|
+
|
56
|
+
Use blocks to define nested TreeStruct.
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
class NestedTreeStruct < TreeStruct
|
60
|
+
attribute :name
|
61
|
+
attribute :year
|
62
|
+
attribute :car do
|
63
|
+
attribute :model
|
64
|
+
attribute :driver
|
65
|
+
attribute :engine do
|
66
|
+
attribute :power
|
67
|
+
attribute :volume
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
```
|
72
|
+
|
73
|
+
Or explicitly define nested TreeStruct classes.
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
class EngineTreeStruct < TreeStruct
|
77
|
+
attribute :power
|
78
|
+
attribute :volume
|
79
|
+
end
|
80
|
+
class CarTreeStruct < TreeStruct
|
81
|
+
attribute :model
|
82
|
+
attribute :driver
|
83
|
+
attribute :engine, class: EngineTreeStruct
|
84
|
+
end
|
85
|
+
class NestedTreeStruct < TreeStruct
|
86
|
+
attribute :name
|
87
|
+
attribute :year
|
88
|
+
attribute :car, class: CarTreeStruct
|
89
|
+
end
|
90
|
+
```
|
91
|
+
|
92
|
+
Access attributes via dot notation.
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
nested_tree_struct = NestedTreeStruct.new
|
96
|
+
nested_tree_struct.name = 'Ferrari' # => "Ferrari"
|
97
|
+
nested_tree_struct.year = 1950 # => 1950
|
98
|
+
nested_tree_struct.car.model = '340 F1' # => "340 F1"
|
99
|
+
nested_tree_struct.car.driver = 'Ascari' # => "Ascari"
|
100
|
+
nested_tree_struct.car.engine.power = 335 # => 335
|
101
|
+
nested_tree_struct.car.engine.volume = 4.1 # => 4.1
|
102
|
+
```
|
103
|
+
|
104
|
+
#### 1.2. Array of TreeStruct Objects
|
105
|
+
|
106
|
+
Specify attribute parameter `array: true` in order to define an array of TreeStruct objects
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
class ArrayTreeStruct < TreeStruct
|
110
|
+
attribute :name
|
111
|
+
attribute :year
|
112
|
+
attribute :cars, array: true do
|
113
|
+
attribute :model
|
114
|
+
attribute :driver
|
115
|
+
attribute :engine do
|
116
|
+
attribute :power
|
117
|
+
attribute :volume
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
```
|
122
|
+
|
123
|
+
or
|
124
|
+
|
125
|
+
```ruby
|
126
|
+
class EngineTreeStruct < TreeStruct
|
127
|
+
attribute :power
|
128
|
+
attribute :volume
|
129
|
+
end
|
130
|
+
class CarTreeStruct < TreeStruct
|
131
|
+
attribute :model
|
132
|
+
attribute :driver
|
133
|
+
attribute :engine, class: EngineTreeStruct
|
134
|
+
end
|
135
|
+
class ArrayTreeStruct < TreeStruct
|
136
|
+
attribute :name
|
137
|
+
attribute :year
|
138
|
+
attribute :cars, array: true, class: CarTreeStruct
|
139
|
+
end
|
140
|
+
```
|
141
|
+
|
142
|
+
Add new elements in the array by using method :create which adds a new it.
|
143
|
+
|
144
|
+
```ruby
|
145
|
+
array_tree_struct = ArrayTreeStruct.new
|
146
|
+
array_tree_struct.name = 'Ferrari' # => "Ferrari"
|
147
|
+
array_tree_struct.year = 1950 # => 1950
|
148
|
+
array_tree_struct.size # => 0
|
149
|
+
array_tree_struct.cars.create
|
150
|
+
array_tree_struct.size # => 1
|
151
|
+
array_tree_struct.cars[0].model = '340 F1' # => "340 F1"
|
152
|
+
array_tree_struct.cars[0].driver = 'Ascari' # => "Ascari"
|
153
|
+
array_tree_struct.cars[0].engine.power = 335 # => 335
|
154
|
+
array_tree_struct.cars[0].engine.volume = 4.1 # => 4.1
|
155
|
+
```
|
156
|
+
|
157
|
+
### 2. Serialize to Hash
|
158
|
+
|
159
|
+
Call `to_hash` method in order to get hash representation of the TreeStruct object
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
simple_tree_struct.to_hash # => {
|
163
|
+
# => :name => "Ferrari",
|
164
|
+
# => :year => 1950
|
165
|
+
# => }
|
166
|
+
```
|
167
|
+
|
168
|
+
#### 2.1. Nested TreeStruct Objects
|
169
|
+
|
170
|
+
```ruby
|
171
|
+
nested_tree_struct.to_hash # => {
|
172
|
+
# => :name => "Ferrari",
|
173
|
+
# => :year => 1950,
|
174
|
+
# => :car => {
|
175
|
+
# => :model => "340 F1",
|
176
|
+
# => :driver => "Ascari",
|
177
|
+
# => :engine => {
|
178
|
+
# => :power => 335,
|
179
|
+
# => :volume => 4.1
|
180
|
+
# => }
|
181
|
+
# => }
|
182
|
+
# => }
|
183
|
+
```
|
184
|
+
|
185
|
+
#### 3.2. Array of TreeStruct Objects
|
186
|
+
|
187
|
+
```ruby
|
188
|
+
array_tree_struct.to_hash # => {
|
189
|
+
# => :name => "Ferrari",
|
190
|
+
# => :year => 1950,
|
191
|
+
# => :cars => [{
|
192
|
+
# => :model => "340 F1",
|
193
|
+
# => :driver => "Ascari",
|
194
|
+
# => :engine => {
|
195
|
+
# => :power => 335,
|
196
|
+
# => :volume => 4.1
|
197
|
+
# => }
|
198
|
+
# => }]
|
199
|
+
# => }
|
200
|
+
```
|
201
|
+
|
202
|
+
### 3. Reference Guide: `attribute` parameters
|
203
|
+
|
204
|
+
| Parameter | Condition | Default value | Description |
|
205
|
+
| --- |:---:|:---:| --- |
|
206
|
+
| array | block* or `:class`** | `false` | This attribute is an array of TreeStruct objects. The structure of array element is described either in the block or in the separate class referenced by `:class` parameter |
|
207
|
+
| class | - | - | This attribute is either nested TreeStruct object or an array of TreeStruct objects. The value of this parameter is a class or a name of a class of this TreeStruct object. |
|
208
|
+
\* block - means that there is block definition for the attribute
|
209
|
+
|
210
|
+
\** `:class` - means that this attribute has `:class` parameter specified
|
211
|
+
## Development
|
212
|
+
|
213
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
214
|
+
|
215
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
216
|
+
|
217
|
+
## Contributing
|
218
|
+
|
219
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/akoltun/tree_struct.
|
220
|
+
|
221
|
+
## License
|
222
|
+
|
223
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "tree_struct"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'tree_struct'
|
2
|
+
|
3
|
+
class TreeStruct
|
4
|
+
class Attribute
|
5
|
+
attr_reader :name
|
6
|
+
|
7
|
+
def initialize(name, array: false, class: nil, default: nil, parent:, &block)
|
8
|
+
@name = name.to_sym
|
9
|
+
@array = array
|
10
|
+
@default_value = default
|
11
|
+
@parent = parent
|
12
|
+
|
13
|
+
@nested_class = binding.local_variable_get(:class)
|
14
|
+
@nested_class = Class.new(@parent.nested_class, &block) if !@nested_class && block_given?
|
15
|
+
|
16
|
+
raise ArgumentError.new('Nested structure has to be defined (either with :class parameter or with block) for arrays if :default parameter is not specified') if @array && @nested_class.nil? && @default_value.nil?
|
17
|
+
end
|
18
|
+
|
19
|
+
def subform?
|
20
|
+
!@nested_class.nil?
|
21
|
+
end
|
22
|
+
|
23
|
+
def validate_value!(value)
|
24
|
+
if @nested_class
|
25
|
+
if @array
|
26
|
+
unless value.class == @parent.array_class
|
27
|
+
raise ArgumentError.new(":#{@name} attribute value should be of class #{@parent.nested_class.name}::Array while attempt to assign value of class #{value.class.name}")
|
28
|
+
end
|
29
|
+
unless value.item_class == @nested_class
|
30
|
+
raise ArgumentError.new(":#{@name} attribute value should be an array with items of class #{@nested_class.name} while attempt to assign an array with items of class #{value.item_class.name}")
|
31
|
+
end
|
32
|
+
|
33
|
+
else
|
34
|
+
unless value.class == @nested_class
|
35
|
+
raise ArgumentError.new(":#{@name} attribute value should be of class #{@nested_class.name} while attempt to assign value of class #{value.class.name}")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def default_value
|
42
|
+
if @default_value.nil?
|
43
|
+
if @nested_class
|
44
|
+
if @array
|
45
|
+
@parent.array_class.new(@nested_class)
|
46
|
+
else
|
47
|
+
@nested_class.new
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
elsif @default_value.is_a? Proc
|
52
|
+
@default_value.call(@parent, self)
|
53
|
+
|
54
|
+
else
|
55
|
+
@default_value
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/tree_struct.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require "tree_struct/version"
|
2
|
+
require "tree_struct/array"
|
3
|
+
require "tree_struct/attribute"
|
4
|
+
require "tree_struct/attributes"
|
5
|
+
require 'active_support/core_ext/class/attribute'
|
6
|
+
|
7
|
+
class TreeStruct
|
8
|
+
private
|
9
|
+
|
10
|
+
class_attribute :_attributes, instance_predicate: false, instance_reader: false, instance_writer: false
|
11
|
+
self._attributes = Attributes.new
|
12
|
+
|
13
|
+
def self._define_attribute_getter(attribute)
|
14
|
+
define_method attribute.name do
|
15
|
+
_get_attribute_value(attribute)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self._define_attribute_setter(attribute)
|
20
|
+
define_method "#{attribute.name}=" do |value|
|
21
|
+
_set_attribute_value(attribute, value)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
public
|
26
|
+
|
27
|
+
def self.array_class
|
28
|
+
Array
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.nested_class
|
32
|
+
::TreeStruct
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.attribute_class
|
36
|
+
Attribute
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.attribute(name, opts = {}, &block)
|
40
|
+
attr = self.attribute_class.new(name, opts.merge(parent: self), &block)
|
41
|
+
self._attributes = self._attributes.add(attr)
|
42
|
+
self._define_attribute_getter(attr)
|
43
|
+
self._define_attribute_setter(attr)
|
44
|
+
self
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.attributes
|
48
|
+
self._attributes.map(&:name)
|
49
|
+
end
|
50
|
+
|
51
|
+
def to_hash
|
52
|
+
Hash[self.class._attributes.map { |attribute| [attribute.name, attribute.subform? ? send(attribute.name).to_hash : send(attribute.name)] }]
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def _get_attribute_value(attribute)
|
58
|
+
value = instance_variable_get("@#{attribute.name}")
|
59
|
+
value = instance_variable_set("@#{attribute.name}", attribute.default_value) if value.nil?
|
60
|
+
value
|
61
|
+
end
|
62
|
+
|
63
|
+
def _set_attribute_value(attribute, value)
|
64
|
+
attribute.validate_value!(value)
|
65
|
+
instance_variable_set("@#{attribute.name}", value)
|
66
|
+
end
|
67
|
+
end
|
data/tree_struct.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "tree_struct/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "tree_struct"
|
8
|
+
spec.version = TreeStruct::VERSION
|
9
|
+
spec.authors = ["Alexander Koltun"]
|
10
|
+
spec.email = ["alexander.koltun@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Similar to Ruby Struct class but allows to describe nested and arrayed structures}
|
13
|
+
spec.description = %q{TreeStruct allows to describe a structure with nested TreeStruct and with arrays of TreeStruct.
|
14
|
+
The level of nesting is not limited.}
|
15
|
+
spec.homepage = "https://github.com/akoltun/tree_struct"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
19
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
20
|
+
if spec.respond_to?(:metadata)
|
21
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
22
|
+
else
|
23
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
24
|
+
"public gem pushes."
|
25
|
+
end
|
26
|
+
|
27
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
28
|
+
f.match(%r{^(test|spec|features)/})
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
spec.add_dependency "typed_array", ">= 1.0.0"
|
35
|
+
spec.add_dependency "activesupport", ">= 3.2"
|
36
|
+
|
37
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
38
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
39
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tree_struct
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexander Koltun
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: typed_array
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.16'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.16'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
description: |-
|
84
|
+
TreeStruct allows to describe a structure with nested TreeStruct and with arrays of TreeStruct.
|
85
|
+
The level of nesting is not limited.
|
86
|
+
email:
|
87
|
+
- alexander.koltun@gmail.com
|
88
|
+
executables: []
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- ".gitignore"
|
93
|
+
- ".rspec"
|
94
|
+
- ".travis.yml"
|
95
|
+
- Gemfile
|
96
|
+
- Gemfile.lock
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- bin/console
|
101
|
+
- bin/setup
|
102
|
+
- lib/tree_struct.rb
|
103
|
+
- lib/tree_struct/array.rb
|
104
|
+
- lib/tree_struct/attribute.rb
|
105
|
+
- lib/tree_struct/attributes.rb
|
106
|
+
- lib/tree_struct/version.rb
|
107
|
+
- tree_struct.gemspec
|
108
|
+
homepage: https://github.com/akoltun/tree_struct
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata:
|
112
|
+
allowed_push_host: https://rubygems.org
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options: []
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
requirements: []
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 2.4.5.3
|
130
|
+
signing_key:
|
131
|
+
specification_version: 4
|
132
|
+
summary: Similar to Ruby Struct class but allows to describe nested and arrayed structures
|
133
|
+
test_files: []
|