statham 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +58 -0
- data/Rakefile +6 -0
- data/lib/statham/attribute.rb +61 -0
- data/lib/statham/attribute_set.rb +47 -0
- data/lib/statham/document.rb +92 -0
- data/lib/statham/serializer.rb +59 -0
- data/lib/statham/version.rb +3 -0
- data/lib/statham.rb +8 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/support/active_record.rb +5 -0
- data/spec/support/schema.rb +5 -0
- data/spec/unit/attribute_set_spec.rb +9 -0
- data/spec/unit/attribute_spec.rb +24 -0
- data/spec/unit/document_spec.rb +35 -0
- data/spec/unit/serializer_spec.rb +31 -0
- data/statham.gemspec +28 -0
- metadata +155 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6b874caa4c2b43695d5b4df17ba6afe935cea0b2
|
4
|
+
data.tar.gz: f021b56b8ec690530247373a3a549c785b2fdab3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f2be195a49962c4d8ca0e40e3e124802d568900ca2f87e20619cf77719cbdc16741a6c68ad4f72765f5a993f7f5d196bfbd4c4003a5daaabed10537b13649bd3
|
7
|
+
data.tar.gz: 82b4bac5b759c7ff0db07cb1508d212102b9aba218a86c4ac335db95e0d036bfb98c902d07b27526f689cb819af9a31484b7d1a4501f1140885ecf0899267866
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Inbeom Hwang
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Statham
|
2
|
+
|
3
|
+
Do serialization like boss.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'statham'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Mix in `Statham::Document` in models you want:
|
18
|
+
|
19
|
+
class Post < ActiveRecord::Base
|
20
|
+
include Statham::Document
|
21
|
+
end
|
22
|
+
|
23
|
+
Do migration:
|
24
|
+
|
25
|
+
change_table :post do |t|
|
26
|
+
t.text :metadata
|
27
|
+
end
|
28
|
+
|
29
|
+
Define schema for serialization:
|
30
|
+
|
31
|
+
class Post < ActiveRecord::Base
|
32
|
+
include Statham::Document
|
33
|
+
|
34
|
+
statham :metadata do |json|
|
35
|
+
json.attribute :transporter, type: :string, default: 'frank'
|
36
|
+
json.attribute :italian_job, type: :integer
|
37
|
+
json.attribute :the_expandables, type: :boolean
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
That's it.
|
42
|
+
|
43
|
+
The attributes defined in the JSON behaves like regular attributes. Thus You can
|
44
|
+
use them on forms and views:
|
45
|
+
|
46
|
+
<%= form_for @post do |f| %>
|
47
|
+
<%= f.checkbox :the_expandables %>
|
48
|
+
<%= f.input :transporter %>
|
49
|
+
<%= f.input :italian_job %>
|
50
|
+
<% end %>
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
1. Fork it
|
55
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
56
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
57
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
58
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
module Statham
|
2
|
+
# Internal: Attributes serialized inside JSON.
|
3
|
+
class Attribute
|
4
|
+
# Internal: Type of the attribute.
|
5
|
+
attr_accessor :type
|
6
|
+
# Internal: Default value for the attribute.
|
7
|
+
attr_accessor :default
|
8
|
+
|
9
|
+
# Internal: Initialize the attribute.
|
10
|
+
#
|
11
|
+
# options - The hash options used for defining new attributes:
|
12
|
+
# type - Type of the attribute.
|
13
|
+
# default - Default value for the attribute.
|
14
|
+
#
|
15
|
+
# Returns new Statham::Attribute object.
|
16
|
+
def initialize(options = {})
|
17
|
+
@type = options[:type]
|
18
|
+
@default = options[:default]
|
19
|
+
end
|
20
|
+
|
21
|
+
# Internal: Serializes value to be JSON-compatible.
|
22
|
+
#
|
23
|
+
# value - Value to serialize.
|
24
|
+
#
|
25
|
+
# Returns serialized value.
|
26
|
+
def serialize(value)
|
27
|
+
serialized = value.nil? ? nil : casted_to_type(value)
|
28
|
+
|
29
|
+
serialized.nil? && !@default.nil? ? @default : serialized
|
30
|
+
end
|
31
|
+
|
32
|
+
# Internal: Deserializes JSON-compatible value to native one.
|
33
|
+
#
|
34
|
+
# value - Value to deserialize.
|
35
|
+
#
|
36
|
+
# Returns deserialized value.
|
37
|
+
def deserialize(value)
|
38
|
+
deserialized = value.nil? ? nil : casted_to_type(value)
|
39
|
+
|
40
|
+
deserialized.nil? && !@default.nil? ? @default : deserialized
|
41
|
+
end
|
42
|
+
|
43
|
+
protected
|
44
|
+
|
45
|
+
# Internal: Casts value to type defined for the attribute.
|
46
|
+
#
|
47
|
+
# value - Value to cast type.
|
48
|
+
#
|
49
|
+
# Returns value with type casted.
|
50
|
+
def casted_to_type(value)
|
51
|
+
case @type
|
52
|
+
when :boolean
|
53
|
+
ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value)
|
54
|
+
when :integer
|
55
|
+
value.to_i
|
56
|
+
else
|
57
|
+
value.to_s
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Statham
|
2
|
+
# Public: Collection of definition of child attributes inside JSON.
|
3
|
+
class AttributeSet
|
4
|
+
# Public: Name of the parent JSON attribute.
|
5
|
+
attr_reader :name
|
6
|
+
# Public: AttributeSet defined in the parent class of the owner of the
|
7
|
+
# AttributeSet.
|
8
|
+
attr_reader :parent
|
9
|
+
|
10
|
+
# Internal: Initialize an AttributeSet.
|
11
|
+
#
|
12
|
+
# options - The hash options used to define AttributeSets:
|
13
|
+
# :name - Name of the parent attribute.
|
14
|
+
#
|
15
|
+
# Returns new AttributeSet.
|
16
|
+
def initialize(options = {})
|
17
|
+
@name = options[:name]
|
18
|
+
@parent = options[:parent]
|
19
|
+
@attributes = {}
|
20
|
+
end
|
21
|
+
|
22
|
+
# Public: Define an attribute serialized inside JSON.
|
23
|
+
#
|
24
|
+
# name - Name of the attribute.
|
25
|
+
# options - The hash options used to define new attribute:
|
26
|
+
# :type - Type of the attribute.
|
27
|
+
# :default - Default value for the attribute.
|
28
|
+
#
|
29
|
+
# Returns nothing.
|
30
|
+
def attribute(name, options = {})
|
31
|
+
@attributes[name] = Statham::Attribute.new(options)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Public: Collection of attributes definition. If parent AttributeSet
|
35
|
+
# exists, it merges attributes on the AttributeSet with attributes of
|
36
|
+
# parent.
|
37
|
+
#
|
38
|
+
# Returns Hash collection of attributes.
|
39
|
+
def attributes
|
40
|
+
if @parent
|
41
|
+
@attributes.reverse_merge @parent.attributes
|
42
|
+
else
|
43
|
+
@attributes
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
module Statham
|
2
|
+
# Public: Mixin for ActiveRecord models which enables defining attributes
|
3
|
+
# serialized into a JSON attribute.
|
4
|
+
#
|
5
|
+
# Examples
|
6
|
+
#
|
7
|
+
# class Foo < ActiveRecord::Base
|
8
|
+
# include Statham::Document
|
9
|
+
#
|
10
|
+
# statham :metdata do |json|
|
11
|
+
# json.attribute :foo, type: :integer
|
12
|
+
# json.attribute :bar
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# Each attribute is given name and options including type and default value.
|
17
|
+
module Document
|
18
|
+
extend ActiveSupport::Concern
|
19
|
+
|
20
|
+
module ClassMethods
|
21
|
+
# Public: Initializes and creates JSON attribute with specified name
|
22
|
+
# containing defined child attributes.
|
23
|
+
#
|
24
|
+
# column_name - Symbol object containing name of parent JSON column.
|
25
|
+
# block - Required block containing definitions for child
|
26
|
+
# attributes.
|
27
|
+
#
|
28
|
+
# Returns Statham::AttributeSet object for newly defined parent JSON.
|
29
|
+
def statham(column_name, &block)
|
30
|
+
parent = parent_statham_attribute_set_for(column_name)
|
31
|
+
attribute_set = statham_attribute_sets[column_name] ||= Statham::AttributeSet.new(name: column_name, parent: parent)
|
32
|
+
|
33
|
+
yield attribute_set if block_given?
|
34
|
+
|
35
|
+
apply_statham_attribute_set(attribute_set)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Internal: Collection of JSON attributes used as parent attributes for a
|
39
|
+
# class.
|
40
|
+
#
|
41
|
+
# Returns hash object for the collection.
|
42
|
+
def statham_attribute_sets
|
43
|
+
statham_attribute_sets_collection[self] ||= {}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Internal: Collection of statham_attribute_sets for related classes.
|
47
|
+
#
|
48
|
+
# Returns hash object for the collection.
|
49
|
+
def statham_attribute_sets_collection
|
50
|
+
@@attribute_sets_collection ||= {}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Internal: Find AttributeSets defined in parent classes and return the
|
54
|
+
# nearest AttributeSet if it exists.
|
55
|
+
#
|
56
|
+
# column_name - Name of the column to find.
|
57
|
+
#
|
58
|
+
# Returns AttributeSet with parent set.
|
59
|
+
def parent_statham_attribute_set_for(column_name)
|
60
|
+
parent = statham_attribute_sets_collection.inject({}) do |parents, (klass, attribute_sets)|
|
61
|
+
if klass > self && parent_attribute_set = attribute_sets[column_name]
|
62
|
+
parents.merge(klass => parent_attribute_set)
|
63
|
+
else
|
64
|
+
parents
|
65
|
+
end
|
66
|
+
end.sort.first
|
67
|
+
|
68
|
+
parent && parent.last
|
69
|
+
end
|
70
|
+
|
71
|
+
# Internal: Define required getter/setter methods for child attributes
|
72
|
+
# in JSON and set up ActiveRecord serialization with the set.
|
73
|
+
#
|
74
|
+
# set - AttributeSet object to apply.
|
75
|
+
#
|
76
|
+
# Returns attributes in AttributeSet object.
|
77
|
+
def apply_statham_attribute_set(attribute_set)
|
78
|
+
serialize attribute_set.name, Statham::Serializer.new(attribute_set)
|
79
|
+
|
80
|
+
attribute_set.attributes.each do |name, attribute|
|
81
|
+
define_method(name) do
|
82
|
+
attribute.deserialize(send(attribute_set.name)[name])
|
83
|
+
end
|
84
|
+
|
85
|
+
define_method("#{name}=") do |value|
|
86
|
+
send(attribute_set.name)[name] = attribute.serialize(value)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Statham
|
2
|
+
# Internal: Serializes/deserializes collection of attributes into/from JSON.
|
3
|
+
class Serializer
|
4
|
+
# Internal: Initializes Serializer.
|
5
|
+
#
|
6
|
+
# attribute_set - AttributeSet object for definition of the attributes.
|
7
|
+
#
|
8
|
+
# Returns new Serializer object.
|
9
|
+
def initialize(attribute_set)
|
10
|
+
@attribute_set = attribute_set
|
11
|
+
end
|
12
|
+
|
13
|
+
# Internal: Serializes object.
|
14
|
+
#
|
15
|
+
# object - Object to serialize.
|
16
|
+
#
|
17
|
+
# Returns JSON string for the object.
|
18
|
+
def dump(object)
|
19
|
+
ActiveSupport::JSON.encode(serialize_with_attributes(object))
|
20
|
+
end
|
21
|
+
|
22
|
+
# Internal: Deserializes JSON string into object.
|
23
|
+
#
|
24
|
+
# json - JSON string to deserialize.
|
25
|
+
#
|
26
|
+
# Returns Hash object deserialized from the JSON.
|
27
|
+
def load(json)
|
28
|
+
object = json ? ActiveSupport::HashWithIndifferentAccess.new(ActiveSupport::JSON.decode(json)) : Hash.new
|
29
|
+
|
30
|
+
deserialize_with_attributes(object)
|
31
|
+
end
|
32
|
+
|
33
|
+
protected
|
34
|
+
|
35
|
+
# Internal: Serialize values in specified hash object using options used to
|
36
|
+
# define attributes.
|
37
|
+
#
|
38
|
+
# object - Object to serialize.
|
39
|
+
#
|
40
|
+
# Returns Hash containing serialized values.
|
41
|
+
def serialize_with_attributes(object)
|
42
|
+
@attribute_set.attributes.inject(object) do |serialized, (name, attribute)|
|
43
|
+
serialized.merge name => attribute.serialize(object[name])
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Internal: Deserialize values in specified hash object using options used
|
48
|
+
# to define attributes.
|
49
|
+
#
|
50
|
+
# object - Object to deserialize.
|
51
|
+
#
|
52
|
+
# Returns Hash containing deserialized values.
|
53
|
+
def deserialize_with_attributes(object)
|
54
|
+
@attribute_set.attributes.inject(object) do |serialized, (name, attribute)|
|
55
|
+
serialized.merge name => attribute.deserialize(object[name])
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/statham.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Statham::Attribute do
|
4
|
+
describe '#serialize' do
|
5
|
+
context 'when type is boolean' do
|
6
|
+
let(:attribute) { Statham::Attribute.new(type: :boolean) }
|
7
|
+
|
8
|
+
it { expect(attribute.serialize(nil)).to be_nil }
|
9
|
+
it { expect(attribute.serialize(true)).to be_true }
|
10
|
+
it { expect(attribute.serialize(false)).to be_false }
|
11
|
+
it { expect(attribute.serialize('1')).to be_true }
|
12
|
+
it { expect(attribute.serialize('0')).to be_false }
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when default value is set' do
|
16
|
+
let(:default) { 'hello' }
|
17
|
+
let(:value) { 'world' }
|
18
|
+
let(:attribute) { Statham::Attribute.new(default: default) }
|
19
|
+
|
20
|
+
it { expect(attribute.serialize(nil)).to eq(default) }
|
21
|
+
it { expect(attribute.serialize(value)).to eq(value) }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class AttributesTestModel < ActiveRecord::Base
|
4
|
+
include Statham::Document
|
5
|
+
|
6
|
+
statham :foo do |json|
|
7
|
+
json.attribute :bar
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class ChildTestModel < AttributesTestModel
|
12
|
+
statham :foo do |json|
|
13
|
+
json.attribute :baz
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class ChildChildTestModel < ChildTestModel
|
18
|
+
statham :foo do |json|
|
19
|
+
json.attribute :qux
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe Statham::Document do
|
24
|
+
describe '.statham_attribute_sets' do
|
25
|
+
it { expect(AttributesTestModel.statham_attribute_sets).to be_a(Hash) }
|
26
|
+
it { expect(AttributesTestModel.statham_attribute_sets.keys).to eq([:foo]) }
|
27
|
+
it { expect(ChildTestModel.statham_attribute_sets).to be_a(Hash) }
|
28
|
+
it { expect(ChildTestModel.statham_attribute_sets.keys).to eq([:foo]) }
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '.parent_statham_attribute_set_for' do
|
32
|
+
it { expect(ChildTestModel.parent_statham_attribute_set_for(:foo)).to eq(AttributesTestModel.statham_attribute_sets[:foo]) }
|
33
|
+
it { expect(ChildChildTestModel.parent_statham_attribute_set_for(:foo)).to eq(ChildTestModel.statham_attribute_sets[:foo]) }
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Statham::Serializer do
|
4
|
+
let(:attribute_set) { Statham::AttributeSet.new(name: :foobar) }
|
5
|
+
|
6
|
+
describe '#dump' do
|
7
|
+
let(:statham_column) { Statham::Serializer.new(attribute_set) }
|
8
|
+
let(:object) { { foo: 'bar' } }
|
9
|
+
|
10
|
+
it { expect(statham_column.dump(object)).to eq('{"foo":"bar"}') }
|
11
|
+
it { expect(ActiveSupport::JSON.decode(statham_column.dump(object))).to eq({ 'foo' => 'bar' }) }
|
12
|
+
|
13
|
+
context 'when attribute_set has attributes' do
|
14
|
+
let(:baz_default) { 'bazbaz' }
|
15
|
+
|
16
|
+
before do
|
17
|
+
attribute_set.attribute :baz, default: baz_default
|
18
|
+
end
|
19
|
+
|
20
|
+
it { expect(ActiveSupport::JSON.decode(statham_column.dump(object))).to eq({ 'foo' => 'bar', 'baz' => baz_default }) }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#load' do
|
25
|
+
let(:statham_column) { Statham::Serializer.new(attribute_set) }
|
26
|
+
let(:object_json) { ActiveSupport::JSON.encode({ foo: 'bar' }) }
|
27
|
+
|
28
|
+
it { expect(statham_column.load(object_json)).to eq({ 'foo' => 'bar' }) }
|
29
|
+
it { expect(statham_column.load(object_json)[:foo]).to eq('bar') }
|
30
|
+
end
|
31
|
+
end
|
data/statham.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'statham/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'statham'
|
8
|
+
spec.version = Statham::VERSION
|
9
|
+
spec.authors = ['Inbeom Hwang']
|
10
|
+
spec.email = ['hwanginbeom@gmail.com']
|
11
|
+
spec.description = %q{Manage JSON object in string typed attributes for ActiveRecord models}
|
12
|
+
spec.summary = %q{JSON objects for attributes}
|
13
|
+
spec.homepage = ''
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'activesupport'
|
22
|
+
spec.add_dependency 'activerecord'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', "~> 1.3"
|
25
|
+
spec.add_development_dependency 'rake'
|
26
|
+
spec.add_development_dependency 'rspec'
|
27
|
+
spec.add_development_dependency 'sqlite3'
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: statham
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Inbeom Hwang
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activerecord
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
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.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '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: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sqlite3
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Manage JSON object in string typed attributes for ActiveRecord models
|
98
|
+
email:
|
99
|
+
- hwanginbeom@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- .gitignore
|
105
|
+
- Gemfile
|
106
|
+
- LICENSE.txt
|
107
|
+
- README.md
|
108
|
+
- Rakefile
|
109
|
+
- lib/statham.rb
|
110
|
+
- lib/statham/attribute.rb
|
111
|
+
- lib/statham/attribute_set.rb
|
112
|
+
- lib/statham/document.rb
|
113
|
+
- lib/statham/serializer.rb
|
114
|
+
- lib/statham/version.rb
|
115
|
+
- spec/spec_helper.rb
|
116
|
+
- spec/support/active_record.rb
|
117
|
+
- spec/support/schema.rb
|
118
|
+
- spec/unit/attribute_set_spec.rb
|
119
|
+
- spec/unit/attribute_spec.rb
|
120
|
+
- spec/unit/document_spec.rb
|
121
|
+
- spec/unit/serializer_spec.rb
|
122
|
+
- statham.gemspec
|
123
|
+
homepage: ''
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata: {}
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - '>='
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
requirements: []
|
142
|
+
rubyforge_project:
|
143
|
+
rubygems_version: 2.0.6
|
144
|
+
signing_key:
|
145
|
+
specification_version: 4
|
146
|
+
summary: JSON objects for attributes
|
147
|
+
test_files:
|
148
|
+
- spec/spec_helper.rb
|
149
|
+
- spec/support/active_record.rb
|
150
|
+
- spec/support/schema.rb
|
151
|
+
- spec/unit/attribute_set_spec.rb
|
152
|
+
- spec/unit/attribute_spec.rb
|
153
|
+
- spec/unit/document_spec.rb
|
154
|
+
- spec/unit/serializer_spec.rb
|
155
|
+
has_rdoc:
|