plaster 0.1.0.pre.pre → 0.1.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 +8 -8
- data/lib/plaster/model_deconstructor.rb +4 -0
- data/lib/plaster/version.rb +1 -1
- data/lib/plaster/wrapping_list.rb +13 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGEzNGM1OGE5NGM3ZjA5M2NjNWRmYmVhYTUxNjBhM2UxNmEwOWVkNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmFkNmZlNTE4YWI4ZDU4YTQyZDZkMjkzNzBkMmFmODYwNzVhNDc1MQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTY1Zjc2ZDU3MzZhN2Q1MzlkZmQyOWNkNjRkNWI2YWUyODg3M2IzYTU4OGUz
|
10
|
+
MDcxMjFkYmYzODIwOGZkYjhiOTI0NzljN2QzNGNhOTEwNmNlODBiZjEzMzU4
|
11
|
+
ODY2ODhiN2NmMGFkNTlhZTk2OWIyYTM3OTM3MTIwYTkyY2JlN2M=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDc1ZDY2ZGNmMjcxMmYzZjQzZTUxYzY5OGZmNzYyNGU0YmNlYWZiYzQ3ODJk
|
14
|
+
NjM3ZmExODZkNDg5NTk1OTc2Y2I4ZGM0MGIxN2MxOWEwOTE4NzljNzBiZGUw
|
15
|
+
ZWY0YjAzZGIwZjcxNGJkOWIxMDJjYzA2NjcwMjhjMjAxYWYwY2U=
|
@@ -2,6 +2,10 @@ require 'active_support/hash_with_indifferent_access'
|
|
2
2
|
|
3
3
|
module Plaster
|
4
4
|
|
5
|
+
# Deconstructs a hierarchical data structure comprised of
|
6
|
+
# struct-like and array-like objects into a homologous
|
7
|
+
# structure of hashes (HashWithIndifferentAccess) and arrays
|
8
|
+
# (Array).
|
5
9
|
class ModelDeconstructor
|
6
10
|
|
7
11
|
class << self
|
data/lib/plaster/version.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
module Plaster
|
2
2
|
|
3
|
+
# A list of entry values, each stored in an attribute of an
|
4
|
+
# instance of a specified struct-like wrapper class. This
|
5
|
+
# allows the list to apply the same enforcement and/or
|
6
|
+
# transformation that the wrapper's attribute write/read
|
7
|
+
# process does.
|
3
8
|
class WrappingList
|
4
9
|
|
5
10
|
class << self
|
@@ -11,6 +16,9 @@ module Plaster
|
|
11
16
|
|
12
17
|
private
|
13
18
|
|
19
|
+
# Called in the body of a subclass definition to specify
|
20
|
+
# the wrapper class and attribute name in which to store
|
21
|
+
# each entry.
|
14
22
|
def wrap_each(klass, attrib)
|
15
23
|
@wrapper_class = klass
|
16
24
|
@wrapper_attrib = attrib
|
@@ -25,6 +33,10 @@ module Plaster
|
|
25
33
|
@inner_array = []
|
26
34
|
end
|
27
35
|
|
36
|
+
def model_deconstruct
|
37
|
+
Plaster.deconstruct( to_a )
|
38
|
+
end
|
39
|
+
|
28
40
|
def []=(index, value)
|
29
41
|
old_length = inner_array.length
|
30
42
|
wrapper = (
|
@@ -56,6 +68,7 @@ module Plaster
|
|
56
68
|
wrapper = self.class.wrapper_class.new
|
57
69
|
wrapper.send self.class.wrapper_attrib_writer, value
|
58
70
|
inner_array << wrapper
|
71
|
+
self
|
59
72
|
end
|
60
73
|
|
61
74
|
def push(*values)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Jorgensen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -120,9 +120,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: 1.9.3
|
121
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- - ! '
|
123
|
+
- - ! '>='
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
125
|
+
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
128
|
rubygems_version: 2.2.2
|