active_model_serializers_binary 0.0.25 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +96 -123
- data/active_model_serializers_binary.gemspec +12 -12
- data/lib/active_model_serializers_binary/active_model_serializers_binary.rb +128 -35
- data/lib/active_model_serializers_binary/base_type.rb +4 -2
- data/lib/active_model_serializers_binary/data_types.rb +22 -22
- data/lib/active_model_serializers_binary/version.rb +1 -1
- data/test/dummy/app/models/producto.rb +3 -26
- data/test/dummy/app/models/tipo.rb +18 -0
- data/test/dummy/config/environments/test.rb +1 -1
- data/test/dummy/db/migrate/20170817015810_create_tipos.rb +9 -0
- data/test/dummy/db/schema.rb +10 -3
- data/test/dummy/lib/test_parser.rb +9 -30
- data/test/dummy/test/fixtures/productos.yml +2 -2
- data/test/dummy/test/fixtures/tipos.yml +20 -0
- data/test/dummy/test/models/producto_test.rb +2 -2
- data/test/dummy/test/models/tipo_test.rb +18 -0
- metadata +19 -138
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8867fc2c627dc2fe2e4e7c064bd1ed5ae721eb89
|
4
|
+
data.tar.gz: b096205753623930ad89c0c9dd4d308f3ff8ef19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c89aed42e8c94feb10867ee254dec8638e9ecae1ed8b414cef0792ec08e50e000d08dc99c0ea1e0356bbf1efc19b2a086b213efb63d4b69b69b07f8a9b148804
|
7
|
+
data.tar.gz: 7acb69425c7502733109d4200fb255951a93f5354d8cb2d3b6c1662948f521264d470099cab822e472593250aac36eeb4868a34e86a80077988c4c0b30258898
|
data/Gemfile.lock
CHANGED
@@ -1,86 +1,80 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_model_serializers_binary (0.
|
5
|
-
activemodel (~>
|
4
|
+
active_model_serializers_binary (0.1.5)
|
5
|
+
activemodel (~> 5.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
|
11
|
-
actionpack (=
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
actioncable (5.0.0.1)
|
11
|
+
actionpack (= 5.0.0.1)
|
12
|
+
nio4r (~> 1.2)
|
13
|
+
websocket-driver (~> 0.6.1)
|
14
|
+
actionmailer (5.0.0.1)
|
15
|
+
actionpack (= 5.0.0.1)
|
16
|
+
actionview (= 5.0.0.1)
|
17
|
+
activejob (= 5.0.0.1)
|
18
|
+
mail (~> 2.5, >= 2.5.4)
|
19
|
+
rails-dom-testing (~> 2.0)
|
20
|
+
actionpack (5.0.0.1)
|
21
|
+
actionview (= 5.0.0.1)
|
22
|
+
activesupport (= 5.0.0.1)
|
23
|
+
rack (~> 2.0)
|
24
|
+
rack-test (~> 0.6.3)
|
25
|
+
rails-dom-testing (~> 2.0)
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
+
actionview (5.0.0.1)
|
28
|
+
activesupport (= 5.0.0.1)
|
21
29
|
builder (~> 3.1)
|
22
30
|
erubis (~> 2.7.0)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
rails-dom-testing (~> 2.0)
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
33
|
+
activejob (5.0.0.1)
|
34
|
+
activesupport (= 5.0.0.1)
|
35
|
+
globalid (>= 0.3.6)
|
36
|
+
activemodel (5.0.0.1)
|
37
|
+
activesupport (= 5.0.0.1)
|
38
|
+
activerecord (5.0.0.1)
|
39
|
+
activemodel (= 5.0.0.1)
|
40
|
+
activesupport (= 5.0.0.1)
|
41
|
+
arel (~> 7.0)
|
42
|
+
activesupport (5.0.0.1)
|
43
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
44
|
+
i18n (~> 0.7)
|
33
45
|
minitest (~> 5.1)
|
34
|
-
thread_safe (~> 0.1)
|
35
46
|
tzinfo (~> 1.1)
|
36
|
-
annotate (2.
|
37
|
-
activerecord (>= 2.
|
38
|
-
rake (>=
|
39
|
-
arel (
|
40
|
-
bcrypt (3.1.7)
|
47
|
+
annotate (2.7.1)
|
48
|
+
activerecord (>= 3.2, < 6.0)
|
49
|
+
rake (>= 10.4, < 12.0)
|
50
|
+
arel (7.1.1)
|
41
51
|
builder (3.2.2)
|
42
52
|
byebug (4.0.5)
|
43
53
|
columnize (= 0.9.0)
|
44
54
|
coderay (1.1.0)
|
45
|
-
coffee-rails (4.0.1)
|
46
|
-
coffee-script (>= 2.2.0)
|
47
|
-
railties (>= 4.0.0, < 5.0)
|
48
|
-
coffee-script (2.3.0)
|
49
|
-
coffee-script-source
|
50
|
-
execjs
|
51
|
-
coffee-script-source (1.7.1)
|
52
55
|
colorize (0.7.3)
|
53
56
|
columnize (0.9.0)
|
54
|
-
|
55
|
-
bcrypt (~> 3.0)
|
56
|
-
orm_adapter (~> 0.1)
|
57
|
-
railties (>= 3.2.6, < 5)
|
58
|
-
thread_safe (~> 0.1)
|
59
|
-
warden (~> 1.2.3)
|
57
|
+
concurrent-ruby (1.0.2)
|
60
58
|
erubis (2.7.0)
|
61
|
-
|
62
|
-
|
63
|
-
i18n (0.
|
59
|
+
globalid (0.3.7)
|
60
|
+
activesupport (>= 4.1.0)
|
61
|
+
i18n (0.7.0)
|
64
62
|
interception (0.5)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
railties (>= 3.2.16)
|
70
|
-
jquery-validation-rails (1.12.0)
|
71
|
-
railties (>= 3.2, < 5.0)
|
72
|
-
thor (~> 0.14)
|
73
|
-
json (1.8.3)
|
74
|
-
libv8 (3.16.14.3)
|
75
|
-
mail (2.5.4)
|
76
|
-
mime-types (~> 1.16)
|
77
|
-
treetop (~> 1.4.8)
|
63
|
+
loofah (2.0.3)
|
64
|
+
nokogiri (>= 1.5.9)
|
65
|
+
mail (2.6.4)
|
66
|
+
mime-types (>= 1.16, < 4)
|
78
67
|
method_source (0.8.2)
|
79
|
-
mime-types (
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
68
|
+
mime-types (3.1)
|
69
|
+
mime-types-data (~> 3.2015)
|
70
|
+
mime-types-data (3.2016.0521)
|
71
|
+
mini_portile2 (2.1.0)
|
72
|
+
minitest (5.9.0)
|
73
|
+
nio4r (1.2.1)
|
74
|
+
nokogiri (1.6.8)
|
75
|
+
mini_portile2 (~> 2.1.0)
|
76
|
+
pkg-config (~> 1.1.7)
|
77
|
+
pkg-config (1.1.7)
|
84
78
|
pry (0.10.1)
|
85
79
|
coderay (~> 1.1.0)
|
86
80
|
method_source (~> 0.8.1)
|
@@ -96,61 +90,49 @@ GEM
|
|
96
90
|
pry-rescue (1.4.2)
|
97
91
|
interception (>= 0.5)
|
98
92
|
pry
|
99
|
-
rack (
|
100
|
-
rack-test (0.6.
|
93
|
+
rack (2.0.1)
|
94
|
+
rack-test (0.6.3)
|
101
95
|
rack (>= 1.0)
|
102
|
-
rails (
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
96
|
+
rails (5.0.0.1)
|
97
|
+
actioncable (= 5.0.0.1)
|
98
|
+
actionmailer (= 5.0.0.1)
|
99
|
+
actionpack (= 5.0.0.1)
|
100
|
+
actionview (= 5.0.0.1)
|
101
|
+
activejob (= 5.0.0.1)
|
102
|
+
activemodel (= 5.0.0.1)
|
103
|
+
activerecord (= 5.0.0.1)
|
104
|
+
activesupport (= 5.0.0.1)
|
109
105
|
bundler (>= 1.3.0, < 2.0)
|
110
|
-
railties (=
|
111
|
-
sprockets-rails (
|
112
|
-
|
113
|
-
|
114
|
-
|
106
|
+
railties (= 5.0.0.1)
|
107
|
+
sprockets-rails (>= 2.0.0)
|
108
|
+
rails-dom-testing (2.0.1)
|
109
|
+
activesupport (>= 4.2.0, < 6.0)
|
110
|
+
nokogiri (~> 1.6.0)
|
111
|
+
rails-html-sanitizer (1.0.3)
|
112
|
+
loofah (~> 2.0)
|
113
|
+
railties (5.0.0.1)
|
114
|
+
actionpack (= 5.0.0.1)
|
115
|
+
activesupport (= 5.0.0.1)
|
116
|
+
method_source
|
115
117
|
rake (>= 0.8.7)
|
116
118
|
thor (>= 0.18.1, < 2.0)
|
117
|
-
rake (10.
|
118
|
-
ref (1.0.5)
|
119
|
-
sass (3.2.19)
|
120
|
-
sass-rails (4.0.3)
|
121
|
-
railties (>= 4.0.0, < 5.0)
|
122
|
-
sass (~> 3.2.0)
|
123
|
-
sprockets (~> 2.8, <= 2.11.0)
|
124
|
-
sprockets-rails (~> 2.0)
|
119
|
+
rake (10.5.0)
|
125
120
|
slop (3.6.0)
|
126
|
-
sprockets (
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
sprockets (~> 2.8)
|
135
|
-
sqlite3 (1.3.9)
|
136
|
-
therubyracer (0.12.1)
|
137
|
-
libv8 (~> 3.16.14.0)
|
138
|
-
ref
|
121
|
+
sprockets (3.7.0)
|
122
|
+
concurrent-ruby (~> 1.0)
|
123
|
+
rack (> 1, < 3)
|
124
|
+
sprockets-rails (3.2.0)
|
125
|
+
actionpack (>= 4.0)
|
126
|
+
activesupport (>= 4.0)
|
127
|
+
sprockets (>= 3.0.0)
|
128
|
+
sqlite3 (1.3.11)
|
139
129
|
thor (0.19.1)
|
140
|
-
thread_safe (0.3.
|
141
|
-
|
142
|
-
treetop (1.4.15)
|
143
|
-
polyglot
|
144
|
-
polyglot (>= 0.3.1)
|
145
|
-
turbolinks (2.2.2)
|
146
|
-
coffee-rails
|
147
|
-
tzinfo (1.2.1)
|
130
|
+
thread_safe (0.3.5)
|
131
|
+
tzinfo (1.2.2)
|
148
132
|
thread_safe (~> 0.1)
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
warden (1.2.3)
|
153
|
-
rack (>= 1.0)
|
133
|
+
websocket-driver (0.6.4)
|
134
|
+
websocket-extensions (>= 0.1.0)
|
135
|
+
websocket-extensions (0.1.2)
|
154
136
|
yard (0.8.7.6)
|
155
137
|
|
156
138
|
PLATFORMS
|
@@ -160,24 +142,15 @@ DEPENDENCIES
|
|
160
142
|
active_model_serializers_binary!
|
161
143
|
annotate
|
162
144
|
bundler (~> 1.6)
|
163
|
-
coffee-rails (~> 4.0)
|
164
145
|
colorize (~> 0.7)
|
165
|
-
devise (~> 3.2)
|
166
|
-
jbuilder (~> 1.2)
|
167
|
-
jquery-ui-rails (~> 4.2)
|
168
|
-
jquery-validation-rails (~> 1.12)
|
169
146
|
pry
|
170
147
|
pry-byebug
|
171
148
|
pry-doc
|
172
149
|
pry-rails
|
173
150
|
pry-rescue
|
174
|
-
rails (~>
|
151
|
+
rails (~> 5.0)
|
175
152
|
rake (~> 10.3)
|
176
|
-
|
177
|
-
sqlite3 (~> 1.3)
|
178
|
-
therubyracer (~> 0.12)
|
179
|
-
turbolinks (~> 2.2)
|
180
|
-
uglifier (~> 1.3)
|
153
|
+
sqlite3
|
181
154
|
|
182
155
|
BUNDLED WITH
|
183
|
-
1.
|
156
|
+
1.15.3
|
@@ -21,19 +21,19 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.add_development_dependency "bundler", "~> 1.6"
|
23
23
|
s.add_development_dependency "rake", "~> 10.3"
|
24
|
-
s.add_development_dependency "sqlite3"
|
25
|
-
s.add_development_dependency "rails", "~>
|
24
|
+
s.add_development_dependency "sqlite3"
|
25
|
+
s.add_development_dependency "rails", "~> 5.0"
|
26
26
|
|
27
|
-
s.add_development_dependency 'devise', '~> 3.2'
|
28
|
-
s.add_development_dependency 'jquery-ui-rails', '~> 4.2'
|
29
|
-
s.add_development_dependency 'sass-rails', '~> 4.0'
|
30
|
-
s.add_development_dependency 'uglifier', '~> 1.3'
|
31
|
-
s.add_development_dependency 'coffee-rails', '~> 4.0'
|
32
|
-
s.add_development_dependency 'turbolinks', "~> 2.2"
|
33
|
-
s.add_development_dependency 'jbuilder', '~> 1.2'
|
34
|
-
s.add_development_dependency 'jquery-validation-rails', '~> 1.12'
|
35
|
-
s.add_development_dependency 'therubyracer', '~> 0.12'
|
27
|
+
#s.add_development_dependency 'devise', '~> 3.2'
|
28
|
+
#s.add_development_dependency 'jquery-ui-rails', '~> 4.2'
|
29
|
+
#s.add_development_dependency 'sass-rails', '~> 4.0'
|
30
|
+
#s.add_development_dependency 'uglifier', '~> 1.3'
|
31
|
+
#s.add_development_dependency 'coffee-rails', '~> 4.0'
|
32
|
+
#s.add_development_dependency 'turbolinks', "~> 2.2"
|
33
|
+
#s.add_development_dependency 'jbuilder', '~> 1.2'
|
34
|
+
#s.add_development_dependency 'jquery-validation-rails', '~> 1.12'
|
35
|
+
#s.add_development_dependency 'therubyracer', '~> 0.12'
|
36
36
|
s.add_development_dependency "colorize", '~> 0.7'
|
37
37
|
|
38
|
-
s.add_dependency "activemodel", "~>
|
38
|
+
s.add_dependency "activemodel", "~> 5.0"
|
39
39
|
end
|
@@ -17,62 +17,99 @@ module ActiveModel
|
|
17
17
|
self.attr_config = {}
|
18
18
|
|
19
19
|
def attributes
|
20
|
-
keys = self.attr_config.select{|k, v| v[:virtual]==true}.keys
|
20
|
+
keys = self.attr_config.select{ |k, v| v[:virtual]==true }.keys
|
21
21
|
values = keys.map{ |var| self.instance_variable_get("@#{var}") }
|
22
|
-
super.merge(Hash[keys.zip values])
|
22
|
+
(super rescue {}).merge(Hash[keys.zip values])
|
23
23
|
end
|
24
|
+
|
25
|
+
def initialize( *args )
|
26
|
+
super rescue super()
|
27
|
+
initialize_serializer
|
28
|
+
end
|
29
|
+
|
30
|
+
def initialize_serializer
|
31
|
+
self.class.add_virtual_attributes self
|
32
|
+
end
|
33
|
+
|
34
|
+
after_initialize :initialize_serializer rescue nil
|
24
35
|
end
|
25
36
|
|
26
37
|
module ClassMethods
|
38
|
+
def add_virtual_attributes( instance )
|
39
|
+
self.attr_config.each{ |k, v| add_virtual_attribute(instance, k, v) }
|
40
|
+
end
|
41
|
+
|
42
|
+
def add_virtual_attribute( instance, attr_name, attr_value )
|
43
|
+
attr_name = attr_name.to_s
|
44
|
+
if attr_value[:virtual] == true
|
45
|
+
true
|
46
|
+
else
|
47
|
+
if !instance.respond_to? attr_name
|
48
|
+
attr_value[:virtual] = true
|
49
|
+
attr_accessor attr_name
|
50
|
+
true
|
51
|
+
else
|
52
|
+
false
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
27
57
|
# todo: agrupar parametros en hash (rompe la compatibilidad hacia atras)
|
28
|
-
def serialize_options(attr_name, coder, count=1, length=1, virtual=false, &block )
|
29
|
-
attr_accessor(attr_name) if virtual
|
58
|
+
def serialize_options( attr_name, coder, count=1, length=1, virtual=false, &block )
|
30
59
|
self.attr_config.merge!(attr_name.to_s => {:coder => coder, :count => count, :length => length, :block => block, :name => attr_name, :virtual => virtual})
|
31
60
|
end
|
32
61
|
|
62
|
+
def serialize_attribute_options( attr_name, options, &block )
|
63
|
+
self.attr_config.merge!(attr_name.to_s => options.merge({ block: block }))
|
64
|
+
end
|
65
|
+
|
33
66
|
def int8( attr_name, options = {}, &block )
|
34
|
-
|
67
|
+
serialize_attribute_options attr_name, options.merge({coder: DataTypes::Int8}), &block
|
35
68
|
end
|
36
69
|
|
37
70
|
def int16( attr_name, options = {}, &block )
|
38
|
-
|
71
|
+
serialize_attribute_options attr_name, options.merge({coder: DataTypes::Int16}), &block
|
39
72
|
end
|
40
73
|
|
41
74
|
def int32( attr_name, options = {}, &block )
|
42
|
-
|
75
|
+
serialize_attribute_options attr_name, options.merge({coder: DataTypes::Int32}), &block
|
43
76
|
end
|
44
77
|
|
45
78
|
def uint8( attr_name, options = {}, &block )
|
46
|
-
|
79
|
+
serialize_attribute_options attr_name, options.merge({coder: DataTypes::UInt8}), &block
|
47
80
|
end
|
48
81
|
|
49
82
|
def uint16( attr_name, options = {}, &block )
|
50
|
-
|
83
|
+
serialize_attribute_options attr_name, options.merge({coder: DataTypes::UInt16}), &block
|
51
84
|
end
|
52
85
|
|
53
86
|
def uint32( attr_name, options = {}, &block )
|
54
|
-
|
87
|
+
serialize_attribute_options attr_name, options.merge({coder: DataTypes::UInt32}), &block
|
55
88
|
end
|
56
89
|
|
57
90
|
def bitfield( attr_name, options = {}, &block )
|
58
|
-
|
91
|
+
serialize_attribute_options attr_name, options.merge({coder: DataTypes::BitField}), &block
|
59
92
|
end
|
60
93
|
|
61
94
|
def float32( attr_name, options = {}, &block )
|
62
|
-
|
95
|
+
serialize_attribute_options attr_name, options.merge({coder: DataTypes::Float32}), &block
|
63
96
|
end
|
64
97
|
|
65
98
|
def char( attr_name, options = {}, &block )
|
66
|
-
|
99
|
+
serialize_attribute_options attr_name, options.merge({coder: DataTypes::Char}), &block
|
67
100
|
end
|
68
101
|
|
69
102
|
def bool( attr_name, options = {}, &block )
|
70
|
-
|
103
|
+
serialize_attribute_options attr_name, options.merge({coder: DataTypes::Bool}), &block
|
104
|
+
end
|
105
|
+
|
106
|
+
def nest( attr_name, options={}, &block )
|
107
|
+
serialize_attribute_options attr_name, options.merge({type: :nest}), &block
|
71
108
|
end
|
72
109
|
end
|
73
110
|
|
74
111
|
class Serializer #:nodoc:
|
75
|
-
attr_reader :options
|
112
|
+
#attr_reader :options
|
76
113
|
|
77
114
|
def initialize(serializable, options = nil)
|
78
115
|
@serializable = serializable
|
@@ -80,24 +117,28 @@ module ActiveModel
|
|
80
117
|
end
|
81
118
|
|
82
119
|
def dump
|
83
|
-
serializable_values = @serializable.serializable_hash(options)
|
120
|
+
serializable_values = @serializable.serializable_hash(@options)
|
84
121
|
start_address = @options[:start_address] || 0
|
85
122
|
|
86
|
-
buffer = [] # Buffer
|
87
|
-
tmp_buffer = [] #
|
88
|
-
current_address = start_address*2 + 0.0 #
|
123
|
+
buffer = [] # Data Buffer
|
124
|
+
tmp_buffer = [] # Aux Data Buffer
|
125
|
+
current_address = start_address*2 + 0.0 # Address in bytes
|
89
126
|
|
90
|
-
@serializable.attr_config.each do |
|
91
|
-
|
92
|
-
|
93
|
-
|
127
|
+
@serializable.attr_config.each do |attr_name, attr_options|
|
128
|
+
if attr_options[:type] != :nest
|
129
|
+
var = attr_options[:coder].new(attr_options.merge(parent: @serializable))
|
130
|
+
var.value = serializable_values[attr_name] rescue nil
|
131
|
+
else
|
132
|
+
var = attr_options[:coder].new(serializable_values[attr_name].attributes)
|
133
|
+
end
|
94
134
|
|
95
135
|
byte = current_address.floor
|
96
136
|
bit = (current_address.modulo(1)*8).round
|
97
137
|
|
98
138
|
tmp_buffer = var.dump
|
139
|
+
|
99
140
|
if @options[:align]
|
100
|
-
if !
|
141
|
+
if !attr_options[:type].in? [:bitfield, :bool, :nest]
|
101
142
|
# Se posiciona al principio de un byte
|
102
143
|
if bit != 0
|
103
144
|
byte += 1
|
@@ -118,7 +159,7 @@ module ActiveModel
|
|
118
159
|
end
|
119
160
|
|
120
161
|
# Si los datos ocupan mas de un byte concatena los arrays
|
121
|
-
if !
|
162
|
+
if !attr_options[:type].in? [:bitfield, :bool] and @options[:align]
|
122
163
|
buffer.insert(byte, tmp_buffer).flatten!
|
123
164
|
else # En caso de ser bits
|
124
165
|
tmp_buffer.flatten!
|
@@ -145,14 +186,14 @@ module ActiveModel
|
|
145
186
|
|
146
187
|
current_address = start_address*2 + 0.0 # Dirección en bytes
|
147
188
|
|
148
|
-
@serializable.attr_config.each do |
|
189
|
+
@serializable.attr_config.each do |attr, attr_options|
|
149
190
|
byte = current_address.floor
|
150
191
|
bit = (current_address.modulo(1)*8).round
|
151
192
|
|
152
|
-
var =
|
193
|
+
var = attr_options[:coder].new(attr_options.merge(parent: @serializable)) #creo objeto del tipo de dato pasado
|
153
194
|
|
154
195
|
if @options[:align]
|
155
|
-
if !
|
196
|
+
if !attr_options[:type].in? [:bitfield, :bool, :nest]
|
156
197
|
# Se posiciona al principio de un byte
|
157
198
|
if bit != 0
|
158
199
|
byte += 1
|
@@ -173,27 +214,67 @@ module ActiveModel
|
|
173
214
|
end
|
174
215
|
|
175
216
|
# Si los datos ocupan mas de un byte, obtiene los bytes completos del buffer original
|
176
|
-
if
|
217
|
+
if !attr_options[:type].in? [:bitfield, :bool] and @options[:align]
|
177
218
|
result_deserialized=var.load(buffer.slice(byte, var.size))
|
178
219
|
else # En caso de ser bits
|
179
220
|
tmp_buffer = buffer.slice(byte, (var.size+bit/8.0).ceil)
|
180
221
|
result_deserialized=var.load([tmp_buffer.pack('C*').unpack('b*').first.slice(bit,var.size*8)].pack('b*').unpack('C*'))
|
181
222
|
end
|
182
|
-
|
223
|
+
|
224
|
+
if attr_options[:type] == :nest
|
225
|
+
serialized_values["#{attr}"] = result_deserialized
|
226
|
+
else
|
227
|
+
serialized_values["#{attr}"] = result_deserialized.count>1 ? result_deserialized : result_deserialized.first
|
228
|
+
end
|
183
229
|
current_address = (byte+bit/8.0)+var.size
|
184
230
|
end
|
185
231
|
|
186
232
|
# Asigno los datos leidos
|
187
233
|
serialized_values.each do |k,v|
|
188
|
-
|
189
|
-
@serializable.send("#{k}=", v)
|
190
|
-
else
|
191
|
-
@serializable.instance_variable_set("@#{k}".to_sym, v)
|
192
|
-
end
|
234
|
+
@serializable.send("#{k}=", v)
|
193
235
|
end
|
194
236
|
@serializable
|
195
237
|
end
|
196
238
|
|
239
|
+
# Return size of object in bytes
|
240
|
+
def size
|
241
|
+
serializable_values = @serializable.serializable_hash(@options)
|
242
|
+
start_address = @options[:start_address] || 0
|
243
|
+
|
244
|
+
current_address = 0.0 # Dirección en bytes
|
245
|
+
|
246
|
+
@serializable.attr_config.each do |attr_name, attr_options|
|
247
|
+
var = attr_options[:coder].new(attr_options.merge(parent: @serializable))
|
248
|
+
|
249
|
+
byte = current_address.floor
|
250
|
+
bit = (current_address.modulo(1)*8).round
|
251
|
+
|
252
|
+
if @options[:align]
|
253
|
+
if !attr_options[:type].in? [:bitfield, :bool, :nest]
|
254
|
+
# Se posiciona al principio de un byte
|
255
|
+
if bit != 0
|
256
|
+
byte += 1
|
257
|
+
bit = 0
|
258
|
+
current_address = (byte+bit/8.0)
|
259
|
+
end
|
260
|
+
# Si el dato es una palabra simple, alinea los datos en el siguiente byte par
|
261
|
+
if var.bit_length > 8 and current_address.modulo(2) != 0
|
262
|
+
byte += 1
|
263
|
+
bit = 0
|
264
|
+
end
|
265
|
+
# Si el dato es una palabra doble, alinea los datos en la siguiente palabra par
|
266
|
+
if var.bit_length > 16 and (current_address + start_address*2).modulo(4) != 0
|
267
|
+
byte += 4-byte%4
|
268
|
+
bit = 0
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
current_address = (byte+bit/8.0)+var.size
|
274
|
+
end
|
275
|
+
current_address-start_address
|
276
|
+
end
|
277
|
+
|
197
278
|
end #close class serializer
|
198
279
|
|
199
280
|
# Returns a binary array representing the model. Configuration can be
|
@@ -215,6 +296,8 @@ module ActiveModel
|
|
215
296
|
Serializer.new(self, options).dump
|
216
297
|
end
|
217
298
|
|
299
|
+
alias_method :dump, :to_bytes
|
300
|
+
|
218
301
|
def to_words(options = {}, &block)
|
219
302
|
data = to_bytes(options, &block)
|
220
303
|
byte_count = (data.count/2.0).ceil*2
|
@@ -270,11 +353,21 @@ module ActiveModel
|
|
270
353
|
retVal
|
271
354
|
end
|
272
355
|
|
356
|
+
alias_method :load, :from_bytes
|
357
|
+
|
273
358
|
def from_words(buffer = [], options = {}, &block)
|
274
359
|
data = buffer.pack('v*').unpack('C*')
|
275
360
|
from_bytes(data, options, &block)
|
276
361
|
end
|
277
362
|
|
363
|
+
def size(options = {})
|
364
|
+
default_options = {
|
365
|
+
:align => true
|
366
|
+
}
|
367
|
+
options = default_options.deep_merge(options)
|
368
|
+
Serializer.new(self, options).size
|
369
|
+
end
|
370
|
+
|
278
371
|
end
|
279
372
|
end
|
280
373
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module DataTypes
|
2
2
|
|
3
|
-
class
|
3
|
+
class BaseType
|
4
4
|
|
5
5
|
attr_accessor :raw_value, :bit_length, :type, :sign, :count, :length, :value, :name, :parent
|
6
6
|
|
@@ -53,6 +53,8 @@ module DataTypes
|
|
53
53
|
v.to_s[0...length]
|
54
54
|
when :bool
|
55
55
|
(v.in? [1, true]) ? true : false
|
56
|
+
when :nest
|
57
|
+
v
|
56
58
|
else
|
57
59
|
v.to_i
|
58
60
|
end
|
@@ -78,7 +80,7 @@ module DataTypes
|
|
78
80
|
def check_raw_value(value)
|
79
81
|
check(value, {
|
80
82
|
:type => :uint8,
|
81
|
-
:count => size,
|
83
|
+
:count => (size < 1 ? 1 : size),
|
82
84
|
:length => 1,
|
83
85
|
:bit_length => 8,
|
84
86
|
:sign => :unsigned,
|
@@ -2,88 +2,88 @@ require_relative 'base_type.rb'
|
|
2
2
|
|
3
3
|
module DataTypes
|
4
4
|
|
5
|
-
class Int8 <
|
5
|
+
class Int8 < BaseType
|
6
6
|
def initialize(options = {})
|
7
7
|
super options.merge :bit_length => 8, :sign => :signed
|
8
8
|
end
|
9
9
|
|
10
10
|
def dump(value=nil)
|
11
|
-
before_dump( value )
|
11
|
+
before_dump( value ).pack('c*').unpack('C*')
|
12
12
|
@raw_value = @value
|
13
13
|
end
|
14
14
|
|
15
15
|
def load(raw_value)
|
16
|
-
self.value = check_raw_value(raw_value)
|
16
|
+
self.value = check_raw_value(raw_value).pack('C*').unpack('c*')
|
17
17
|
after_load
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
class Int16 <
|
21
|
+
class Int16 < BaseType
|
22
22
|
def initialize(options = {})
|
23
23
|
super options.merge :bit_length => 16, :sign => :signed
|
24
24
|
end
|
25
25
|
|
26
26
|
def dump(value=nil)
|
27
27
|
before_dump( value )
|
28
|
-
@raw_value = @value.pack('
|
28
|
+
@raw_value = @value.pack('s<*').unpack('C*')
|
29
29
|
end
|
30
30
|
|
31
31
|
def load(raw_value)
|
32
|
-
self.value = check_raw_value(raw_value).pack('C*').unpack('
|
32
|
+
self.value = check_raw_value(raw_value).pack('C*').unpack('s<*')
|
33
33
|
after_load
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
class Int32 <
|
37
|
+
class Int32 < BaseType
|
38
38
|
def initialize(options = {})
|
39
39
|
super options.merge :bit_length => 32, :sign => :signed
|
40
40
|
end
|
41
41
|
|
42
42
|
def dump(value=nil)
|
43
43
|
before_dump( value )
|
44
|
-
@raw_value = @value.pack('
|
44
|
+
@raw_value = @value.pack('l<*').unpack('C*')
|
45
45
|
end
|
46
46
|
|
47
47
|
def load(raw_value)
|
48
|
-
self.value = check_raw_value(raw_value).pack('C*').unpack('
|
48
|
+
self.value = check_raw_value(raw_value).pack('C*').unpack('l<*') if !value.nil?
|
49
49
|
after_load
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
class UInt16 <
|
53
|
+
class UInt16 < BaseType
|
54
54
|
def initialize(options = {})
|
55
55
|
super options.merge :bit_length => 16, :sign => :unsigned
|
56
56
|
end
|
57
57
|
|
58
58
|
def dump(value=nil)
|
59
59
|
before_dump( value )
|
60
|
-
@raw_value = @value.pack('
|
60
|
+
@raw_value = @value.pack('S<*').unpack('C*')
|
61
61
|
end
|
62
62
|
|
63
|
-
def load(raw_value)
|
63
|
+
def load(raw_value)
|
64
64
|
@raw_value = check_raw_value(raw_value)
|
65
|
-
self.value = @raw_value.pack('C*').unpack('
|
65
|
+
self.value = @raw_value.pack('C*').unpack('S<*')
|
66
66
|
after_load
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
class UInt32 <
|
70
|
+
class UInt32 < BaseType
|
71
71
|
def initialize(options = {})
|
72
72
|
super options.merge :bit_length => 32, :sign => :unsigned
|
73
73
|
end
|
74
74
|
|
75
75
|
def dump(value=nil)
|
76
76
|
before_dump( value )
|
77
|
-
@raw_value = @value.pack('
|
77
|
+
@raw_value = @value.pack('L<*').unpack('C*')
|
78
78
|
end
|
79
79
|
|
80
80
|
def load(raw_value)
|
81
|
-
self.value = check_raw_value(raw_value).pack('C*').unpack('
|
81
|
+
self.value = check_raw_value(raw_value).pack('C*').unpack('L<*') if !value.nil?
|
82
82
|
after_load
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
class UInt8 <
|
86
|
+
class UInt8 < BaseType
|
87
87
|
def initialize(options = {})
|
88
88
|
super options.merge :bit_length => 8, :sign => :unsigned
|
89
89
|
end
|
@@ -99,9 +99,9 @@ module DataTypes
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
class BitField <
|
102
|
+
class BitField < BaseType
|
103
103
|
def initialize(options = {})
|
104
|
-
length =
|
104
|
+
length = options[:bin_length].blank? ? 1 : (options[:bin_length] > 32 ? 32 : options[:bin_length])
|
105
105
|
super options.merge :bit_length => length, :sign => :unsigned
|
106
106
|
end
|
107
107
|
|
@@ -137,7 +137,7 @@ module DataTypes
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
class Char <
|
140
|
+
class Char < BaseType
|
141
141
|
def initialize(options = {})
|
142
142
|
super options.merge :bit_length => 8, :sign => nil, :default_value => "\x0"
|
143
143
|
end
|
@@ -153,7 +153,7 @@ module DataTypes
|
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
156
|
-
class Bool <
|
156
|
+
class Bool < BaseType
|
157
157
|
def initialize(options = {})
|
158
158
|
super options.merge :bit_length => 1, :default_value => false
|
159
159
|
end
|
@@ -169,7 +169,7 @@ module DataTypes
|
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
172
|
-
class Float32 <
|
172
|
+
class Float32 < BaseType
|
173
173
|
def initialize(options = {})
|
174
174
|
super options.merge :bit_length => 32, :sign => nil, :default_value => 0.0
|
175
175
|
end
|
@@ -5,12 +5,12 @@
|
|
5
5
|
# id :integer not null, primary key
|
6
6
|
# uid :integer
|
7
7
|
# silo :integer
|
8
|
-
# nombre :string
|
8
|
+
# nombre :string
|
9
9
|
# total_acumulado :integer
|
10
10
|
# bits1 :boolean
|
11
11
|
# bits2 :boolean
|
12
12
|
# ffloat :float
|
13
|
-
# variable :string
|
13
|
+
# variable :string
|
14
14
|
# created_at :datetime
|
15
15
|
# updated_at :datetime
|
16
16
|
#
|
@@ -18,29 +18,6 @@
|
|
18
18
|
class Producto < ActiveRecord::Base
|
19
19
|
include ActiveModel::Serializers::Binary
|
20
20
|
|
21
|
-
int16 :uid
|
22
|
-
int16 :silo
|
23
21
|
char :nombre, count: 1, length: 20
|
24
|
-
|
25
|
-
bool :bits1
|
26
|
-
bool :bits2
|
27
|
-
bool :bits3, virtual: true
|
28
|
-
bool :bits4, virtual: true
|
29
|
-
bool :bits5, virtual: true
|
30
|
-
bool :bits6, virtual: true
|
31
|
-
bool :bits7, virtual: true
|
32
|
-
bool :bits8, virtual: true
|
33
|
-
bool :bits9, virtual: true
|
34
|
-
bool :bits10, virtual: true
|
35
|
-
bool :bits11, virtual: true
|
36
|
-
bool :bits12, virtual: true
|
37
|
-
bool :bits13, virtual: true
|
38
|
-
bool :bits14, virtual: true
|
39
|
-
bool :bits15, virtual: true
|
40
|
-
bool :bits16, virtual: true
|
41
|
-
float32 :ffloat
|
42
|
-
char :variable, count: 1, length: 20 do |field, mode|
|
43
|
-
puts (mode.to_s + ': variable block').blue
|
44
|
-
end
|
45
|
-
int32 :test, count: 10, virtual: true # No existe en la DB
|
22
|
+
nest :tipo, coder: Tipo
|
46
23
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# == Schema Information
|
2
|
+
#
|
3
|
+
# Table name: tipos
|
4
|
+
#
|
5
|
+
# id :integer not null, primary key
|
6
|
+
# name :string
|
7
|
+
# producto_id :integer
|
8
|
+
# created_at :datetime not null
|
9
|
+
# updated_at :datetime not null
|
10
|
+
#
|
11
|
+
|
12
|
+
class Tipo < ActiveRecord::Base
|
13
|
+
include ActiveModel::Serializers::Binary
|
14
|
+
|
15
|
+
int16 :producto_id
|
16
|
+
char :name, count: 1, length: 20
|
17
|
+
|
18
|
+
end
|
@@ -14,7 +14,7 @@ Rails.application.configure do
|
|
14
14
|
|
15
15
|
# Configure static asset server for tests with Cache-Control for performance.
|
16
16
|
config.serve_static_assets = true
|
17
|
-
config.
|
17
|
+
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
18
18
|
|
19
19
|
# Show full error reports and disable caching.
|
20
20
|
config.consider_all_requests_local = true
|
data/test/dummy/db/schema.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
# This file is auto-generated from the current state of the database. Instead
|
3
2
|
# of editing this file, please use the migrations feature of Active Record to
|
4
3
|
# incrementally modify your database, and then regenerate this schema definition.
|
@@ -11,9 +10,9 @@
|
|
11
10
|
#
|
12
11
|
# It's strongly recommended that you check this file into your version control system.
|
13
12
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 20170817015810) do
|
15
14
|
|
16
|
-
create_table "productos", force:
|
15
|
+
create_table "productos", force: :cascade do |t|
|
17
16
|
t.integer "uid"
|
18
17
|
t.integer "silo"
|
19
18
|
t.string "nombre"
|
@@ -26,4 +25,12 @@ ActiveRecord::Schema.define(version: 20160608024807) do
|
|
26
25
|
t.datetime "updated_at"
|
27
26
|
end
|
28
27
|
|
28
|
+
create_table "tipos", force: :cascade do |t|
|
29
|
+
t.string "name"
|
30
|
+
t.integer "producto_id"
|
31
|
+
t.datetime "created_at", null: false
|
32
|
+
t.datetime "updated_at", null: false
|
33
|
+
t.index ["producto_id"], name: "index_tipos_on_producto_id"
|
34
|
+
end
|
35
|
+
|
29
36
|
end
|
@@ -8,42 +8,21 @@ class String
|
|
8
8
|
end
|
9
9
|
|
10
10
|
orig = Producto.new
|
11
|
-
orig.
|
12
|
-
orig.
|
13
|
-
orig.nombre = "MAIZ"
|
14
|
-
orig.total_acumulado = 50
|
15
|
-
orig.bits1 = 1
|
16
|
-
orig.bits2 = 0
|
17
|
-
orig.bits3 = nil
|
18
|
-
orig.bits4 = nil
|
19
|
-
orig.bits5 = nil
|
20
|
-
orig.bits6 = nil
|
21
|
-
orig.bits7 = nil
|
22
|
-
orig.bits8 = nil
|
23
|
-
orig.bits9 = nil
|
24
|
-
orig.bits10 = nil
|
25
|
-
orig.bits11 = nil
|
26
|
-
orig.bits12 = nil
|
27
|
-
orig.bits13 = nil
|
28
|
-
orig.bits14 = nil
|
29
|
-
orig.bits15 = nil
|
30
|
-
orig.bits16 = nil
|
31
|
-
orig.ffloat= 1.2345678
|
32
|
-
orig.variable = '012345678901234567890123456789'
|
33
|
-
orig.test = (1..10).to_a
|
11
|
+
orig.nombre = "AAAAAAAAAAAAAAAAAAAA"
|
12
|
+
orig.tipo = Tipo.new({name:"BBBBBBBBBBBBBBBBBBBB", producto_id: 0x55AA})
|
34
13
|
|
35
14
|
puts 'Datos originales...'
|
36
15
|
puts orig.inspect.green
|
37
16
|
|
38
17
|
puts 'serializando...'
|
39
|
-
serial = orig.to_bytes
|
40
|
-
puts 'to_bytes block'.blue
|
41
|
-
end
|
18
|
+
serial = orig.to_bytes
|
42
19
|
|
43
20
|
puts serial.inspect.yellow
|
44
21
|
|
45
22
|
puts 'deserializando...'
|
46
|
-
deser = Producto.new.from_bytes serial
|
47
|
-
|
48
|
-
|
49
|
-
|
23
|
+
deser = Producto.new.from_bytes serial
|
24
|
+
puts deser.inspect.green
|
25
|
+
|
26
|
+
must_be_equal = (serial <=> deser.to_bytes) === 0
|
27
|
+
puts "Test OK".green if must_be_equal
|
28
|
+
puts "Test fail".red unless must_be_equal
|
@@ -5,12 +5,12 @@
|
|
5
5
|
# id :integer not null, primary key
|
6
6
|
# uid :integer
|
7
7
|
# silo :integer
|
8
|
-
# nombre :string
|
8
|
+
# nombre :string
|
9
9
|
# total_acumulado :integer
|
10
10
|
# bits1 :boolean
|
11
11
|
# bits2 :boolean
|
12
12
|
# ffloat :float
|
13
|
-
# variable :string
|
13
|
+
# variable :string
|
14
14
|
# created_at :datetime
|
15
15
|
# updated_at :datetime
|
16
16
|
#
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# == Schema Information
|
2
|
+
#
|
3
|
+
# Table name: tipos
|
4
|
+
#
|
5
|
+
# id :integer not null, primary key
|
6
|
+
# name :string
|
7
|
+
# producto_id :integer
|
8
|
+
# created_at :datetime not null
|
9
|
+
# updated_at :datetime not null
|
10
|
+
#
|
11
|
+
|
12
|
+
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
13
|
+
|
14
|
+
one:
|
15
|
+
name: MyString
|
16
|
+
producto: one
|
17
|
+
|
18
|
+
two:
|
19
|
+
name: MyString
|
20
|
+
producto: two
|
@@ -5,12 +5,12 @@
|
|
5
5
|
# id :integer not null, primary key
|
6
6
|
# uid :integer
|
7
7
|
# silo :integer
|
8
|
-
# nombre :string
|
8
|
+
# nombre :string
|
9
9
|
# total_acumulado :integer
|
10
10
|
# bits1 :boolean
|
11
11
|
# bits2 :boolean
|
12
12
|
# ffloat :float
|
13
|
-
# variable :string
|
13
|
+
# variable :string
|
14
14
|
# created_at :datetime
|
15
15
|
# updated_at :datetime
|
16
16
|
#
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# == Schema Information
|
2
|
+
#
|
3
|
+
# Table name: tipos
|
4
|
+
#
|
5
|
+
# id :integer not null, primary key
|
6
|
+
# name :string
|
7
|
+
# producto_id :integer
|
8
|
+
# created_at :datetime not null
|
9
|
+
# updated_at :datetime not null
|
10
|
+
#
|
11
|
+
|
12
|
+
require 'test_helper'
|
13
|
+
|
14
|
+
class TipoTest < ActiveSupport::TestCase
|
15
|
+
# test "the truth" do
|
16
|
+
# assert true
|
17
|
+
# end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_model_serializers_binary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ByS Sistemas de Control
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,156 +42,30 @@ dependencies:
|
|
42
42
|
name: sqlite3
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '4.1'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: devise
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '3.2'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '3.2'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: jquery-ui-rails
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '4.2'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '4.2'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: sass-rails
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '4.0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '4.0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: uglifier
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '1.3'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '1.3'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: coffee-rails
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '4.0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - "~>"
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '4.0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: turbolinks
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '2.2'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - "~>"
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '2.2'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: jbuilder
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - "~>"
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '1.2'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - "~>"
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '1.2'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: jquery-validation-rails
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - "~>"
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '1.12'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - "~>"
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '1.12'
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
name: therubyracer
|
183
|
-
requirement: !ruby/object:Gem::Requirement
|
184
|
-
requirements:
|
185
|
-
- - "~>"
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '0.12'
|
61
|
+
version: '5.0'
|
188
62
|
type: :development
|
189
63
|
prerelease: false
|
190
64
|
version_requirements: !ruby/object:Gem::Requirement
|
191
65
|
requirements:
|
192
66
|
- - "~>"
|
193
67
|
- !ruby/object:Gem::Version
|
194
|
-
version: '0
|
68
|
+
version: '5.0'
|
195
69
|
- !ruby/object:Gem::Dependency
|
196
70
|
name: colorize
|
197
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,14 +86,14 @@ dependencies:
|
|
212
86
|
requirements:
|
213
87
|
- - "~>"
|
214
88
|
- !ruby/object:Gem::Version
|
215
|
-
version: '
|
89
|
+
version: '5.0'
|
216
90
|
type: :runtime
|
217
91
|
prerelease: false
|
218
92
|
version_requirements: !ruby/object:Gem::Requirement
|
219
93
|
requirements:
|
220
94
|
- - "~>"
|
221
95
|
- !ruby/object:Gem::Version
|
222
|
-
version: '
|
96
|
+
version: '5.0'
|
223
97
|
description: active_model_serializers_binary is a declarative way to serialize/deserialize
|
224
98
|
ActiveModel classes for raw data exchange.
|
225
99
|
email:
|
@@ -255,6 +129,7 @@ files:
|
|
255
129
|
- test/dummy/app/models/.keep
|
256
130
|
- test/dummy/app/models/concerns/.keep
|
257
131
|
- test/dummy/app/models/producto.rb
|
132
|
+
- test/dummy/app/models/tipo.rb
|
258
133
|
- test/dummy/app/views/layouts/application.html.erb
|
259
134
|
- test/dummy/bin/bundle
|
260
135
|
- test/dummy/bin/rails
|
@@ -279,6 +154,7 @@ files:
|
|
279
154
|
- test/dummy/config/routes.rb
|
280
155
|
- test/dummy/config/secrets.yml
|
281
156
|
- test/dummy/db/migrate/20160608024807_create_productos.rb
|
157
|
+
- test/dummy/db/migrate/20170817015810_create_tipos.rb
|
282
158
|
- test/dummy/db/schema.rb
|
283
159
|
- test/dummy/lib/assets/.keep
|
284
160
|
- test/dummy/lib/test_parser.rb
|
@@ -288,7 +164,9 @@ files:
|
|
288
164
|
- test/dummy/public/500.html
|
289
165
|
- test/dummy/public/favicon.ico
|
290
166
|
- test/dummy/test/fixtures/productos.yml
|
167
|
+
- test/dummy/test/fixtures/tipos.yml
|
291
168
|
- test/dummy/test/models/producto_test.rb
|
169
|
+
- test/dummy/test/models/tipo_test.rb
|
292
170
|
- test/test_helper.rb
|
293
171
|
homepage: https://github.com/bys-control/active_model_serializers_binary
|
294
172
|
licenses:
|
@@ -310,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
310
188
|
version: '0'
|
311
189
|
requirements: []
|
312
190
|
rubyforge_project:
|
313
|
-
rubygems_version: 2.
|
191
|
+
rubygems_version: 2.4.8
|
314
192
|
signing_key:
|
315
193
|
specification_version: 4
|
316
194
|
summary: Serialize models to/from binary format for raw data exchange
|
@@ -328,6 +206,7 @@ test_files:
|
|
328
206
|
- test/dummy/app/models/.keep
|
329
207
|
- test/dummy/app/models/concerns/.keep
|
330
208
|
- test/dummy/app/models/producto.rb
|
209
|
+
- test/dummy/app/models/tipo.rb
|
331
210
|
- test/dummy/app/views/layouts/application.html.erb
|
332
211
|
- test/dummy/bin/bundle
|
333
212
|
- test/dummy/bin/rails
|
@@ -352,6 +231,7 @@ test_files:
|
|
352
231
|
- test/dummy/config/routes.rb
|
353
232
|
- test/dummy/config/secrets.yml
|
354
233
|
- test/dummy/db/migrate/20160608024807_create_productos.rb
|
234
|
+
- test/dummy/db/migrate/20170817015810_create_tipos.rb
|
355
235
|
- test/dummy/db/schema.rb
|
356
236
|
- test/dummy/lib/assets/.keep
|
357
237
|
- test/dummy/lib/test_parser.rb
|
@@ -361,6 +241,7 @@ test_files:
|
|
361
241
|
- test/dummy/public/500.html
|
362
242
|
- test/dummy/public/favicon.ico
|
363
243
|
- test/dummy/test/fixtures/productos.yml
|
244
|
+
- test/dummy/test/fixtures/tipos.yml
|
364
245
|
- test/dummy/test/models/producto_test.rb
|
246
|
+
- test/dummy/test/models/tipo_test.rb
|
365
247
|
- test/test_helper.rb
|
366
|
-
has_rdoc:
|