vinaigrette 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +77 -0
- data/Rakefile +9 -0
- data/lib/vinaigrette/base.rb +19 -0
- data/lib/vinaigrette/model/accessor.rb +47 -0
- data/lib/vinaigrette/model/belongs_to.rb +41 -0
- data/lib/vinaigrette/model/serialization.rb +34 -0
- data/lib/vinaigrette/serialize.rb +27 -0
- data/lib/vinaigrette/version.rb +3 -0
- data/lib/vinaigrette.rb +11 -0
- data/test/lib/vinaigrette/base_test.rb +110 -0
- data/test/lib/vinaigrette/serialize_test.rb +58 -0
- data/test/lib/vinaigrette/version_test.rb +7 -0
- data/test/test_helper.rb +14 -0
- data/vinaigrette.gemspec +28 -0
- metadata +147 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Yvan BARTHÉLEMY
|
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,77 @@
|
|
1
|
+
# vinaigrette
|
2
|
+
|
3
|
+
vinaigrette is a gem providing a custom `ActiveModel` object that can be used
|
4
|
+
as a serialized attribute of an `ActiveRecord` object.
|
5
|
+
|
6
|
+
## Features
|
7
|
+
|
8
|
+
- Serializable `ActiveModel` objects.
|
9
|
+
- Custom accessors with casting support default values.
|
10
|
+
- Support for Rails validations.
|
11
|
+
- Support for Rails belongs_to associations.
|
12
|
+
- Casting of ruby booleans from strings.
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'vinaigrette'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install vinaigrette
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
Create a custom `Vinaigrette::Base` subclass:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
class AnethSauce < Vinaigrette::Base
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
Add your attributes using `vinaigrette_accessor`:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
# Simple string attribute
|
43
|
+
vinaigrette_accessor :name, String
|
44
|
+
|
45
|
+
# With a default value
|
46
|
+
vinaigrette_accessor :description, String, "Nothing here!"
|
47
|
+
|
48
|
+
# A Boolean
|
49
|
+
vinaigrette_accessor :spicy?, "Boolean", false
|
50
|
+
|
51
|
+
# With support for callables
|
52
|
+
vinaigrette_accessor :secret, String, lambda { something_secret }
|
53
|
+
|
54
|
+
# You can also create belongs_to associations
|
55
|
+
vinaigrette_accessor :sauce_id, Integer
|
56
|
+
belongs_to :sauce
|
57
|
+
```
|
58
|
+
|
59
|
+
Use `vinaigrette_serialize` method to include it in your `ActiveRecord` object:
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
class SalmonDish < ActiveRecord::Base
|
63
|
+
include Vinaigrette::Serialize
|
64
|
+
|
65
|
+
...
|
66
|
+
|
67
|
+
vinaigrette_serialize :sauce, AnethSauce
|
68
|
+
end
|
69
|
+
```
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
1. Fork it
|
74
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
75
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
76
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
77
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'vinaigrette/model/serialization'
|
2
|
+
require 'vinaigrette/model/belongs_to'
|
3
|
+
require 'vinaigrette/model/accessor'
|
4
|
+
|
5
|
+
class Vinaigrette::Base
|
6
|
+
include ActiveModel::Validations
|
7
|
+
|
8
|
+
include Vinaigrette::Model::Serialization
|
9
|
+
include Vinaigrette::Model::BelongsTo
|
10
|
+
include Vinaigrette::Model::Accessor
|
11
|
+
|
12
|
+
def initialize attributes = {}
|
13
|
+
initialize_attributes attributes
|
14
|
+
initialize_association_cache
|
15
|
+
end
|
16
|
+
|
17
|
+
#include ActiveModel::Conversion
|
18
|
+
#extend ActiveModel::Naming
|
19
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Support for casting string to boolean
|
2
|
+
module Kernel
|
3
|
+
def Boolean(string)
|
4
|
+
return true if string== true || string =~ (/^(true|t|yes|y|1)$/i)
|
5
|
+
return false if string== false || string.nil? || string =~ (/^(false|f|no|n|0)$/i)
|
6
|
+
raise ArgumentError.new("invalid value for Boolean: \"#{string}\"")
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
module Vinaigrette::Model
|
11
|
+
module Accessor
|
12
|
+
extend ActiveSupport::Concern
|
13
|
+
|
14
|
+
module ClassMethods
|
15
|
+
def vinaigrette_accessor(accessor, type, default = nil)
|
16
|
+
supported_attributes = instance_variable_get("@supported_attributes") || []
|
17
|
+
supported_attributes.push accessor
|
18
|
+
instance_variable_set("@supported_attributes", supported_attributes)
|
19
|
+
|
20
|
+
@attributes_names ||= []
|
21
|
+
@attributes_names.push accessor
|
22
|
+
|
23
|
+
define_method(accessor) do
|
24
|
+
instance_variable_get("@#{accessor}")
|
25
|
+
end
|
26
|
+
|
27
|
+
define_method("reset_#{accessor}") do
|
28
|
+
value = default.kind_of?(Proc) ? default.call : default
|
29
|
+
instance_variable_set("@#{accessor}", value)
|
30
|
+
end
|
31
|
+
|
32
|
+
define_method("#{accessor}=") do |val|
|
33
|
+
if !val.nil?
|
34
|
+
begin
|
35
|
+
value = Kernel.send(type.to_s, val)
|
36
|
+
instance_variable_set("@#{accessor}", value)
|
37
|
+
rescue Exception => e
|
38
|
+
send("reset_#{accessor}")
|
39
|
+
end
|
40
|
+
else
|
41
|
+
send("reset_#{accessor}")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Vinaigrette::Model
|
2
|
+
module BelongsTo
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
include ActiveRecord::Associations
|
7
|
+
include ActiveRecord::Reflection # belongs_to uses create_reflection
|
8
|
+
|
9
|
+
# Used when fetching an actual record
|
10
|
+
include ActiveRecord::Inheritance # association calls use compute_type
|
11
|
+
include ActiveRecord::AutosaveAssociation # add_autosave_association_callback
|
12
|
+
include ActiveRecord::Callbacks # add_autosave_association_callback
|
13
|
+
end
|
14
|
+
|
15
|
+
# Associations calls [] to retrieve attributes.
|
16
|
+
def [] name
|
17
|
+
attributes[name]
|
18
|
+
end
|
19
|
+
|
20
|
+
# association_cache is assumed to exist by ActiveRecord::Associations
|
21
|
+
def initialize_association_cache
|
22
|
+
@association_cache = {}
|
23
|
+
end
|
24
|
+
|
25
|
+
module ClassMethods
|
26
|
+
# Reflection initialization uses pluralize_table_names
|
27
|
+
def pluralize_table_names
|
28
|
+
false
|
29
|
+
end
|
30
|
+
|
31
|
+
# generated_feature_methods is used when building the association
|
32
|
+
def generated_feature_methods
|
33
|
+
@generated_feature_methods ||= begin
|
34
|
+
mod = const_set(:GeneratedFeatureMethods, Module.new)
|
35
|
+
include mod
|
36
|
+
mod
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Vinaigrette::Model
|
2
|
+
module Serialization
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
include ActiveModel::Serializers::JSON
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize_attributes attributes
|
10
|
+
self.class.attributes_names.each do |k|
|
11
|
+
reset_method = "reset_#{k}".to_sym
|
12
|
+
send(reset_method) if respond_to?(reset_method)
|
13
|
+
end
|
14
|
+
|
15
|
+
attributes.each { |k,v| send("#{k}=".to_sym, v) }
|
16
|
+
end
|
17
|
+
|
18
|
+
def attributes
|
19
|
+
Hash[self.class.attributes_names.map { |name| [name, send(name)] }]
|
20
|
+
end
|
21
|
+
|
22
|
+
module ClassMethods
|
23
|
+
def attributes_names
|
24
|
+
@attributes_names
|
25
|
+
end
|
26
|
+
|
27
|
+
def attr_accessor(*vars)
|
28
|
+
@attributes_names ||= []
|
29
|
+
@attributes_names.concat vars
|
30
|
+
super(*vars)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'active_model'
|
2
|
+
|
3
|
+
module Vinaigrette::Serialize
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
module ClassMethods
|
7
|
+
def vinaigrette_serialize attribute_name, klass
|
8
|
+
validation_method = "__validate_#{attribute_name}".to_sym
|
9
|
+
accessor_method = attribute_name.to_sym
|
10
|
+
|
11
|
+
send(:serialize, attribute_name, Hash)
|
12
|
+
send(:before_validation, validation_method)
|
13
|
+
|
14
|
+
define_method accessor_method do
|
15
|
+
klass.new(attributes[attribute_name.to_s])
|
16
|
+
end
|
17
|
+
|
18
|
+
define_method validation_method do
|
19
|
+
options = klass.new(attributes[attribute_name.to_s])
|
20
|
+
options.valid?
|
21
|
+
options.errors.each do |field, message|
|
22
|
+
errors.add(attribute_name.to_sym, "#{field} #{message}")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/vinaigrette.rb
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
require_relative '../../test_helper'
|
2
|
+
|
3
|
+
describe Vinaigrette::Base do
|
4
|
+
before do
|
5
|
+
Object.send(:remove_const, :DeliciousSauce) if Object.const_defined?(:DeliciousSauce)
|
6
|
+
class DeliciousSauce < Vinaigrette::Base; end
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should be able to use active model validations' do
|
10
|
+
DeliciousSauce.must_respond_to(:validates)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should allow using belongs_to associations' do
|
14
|
+
DeliciousSauce.must_respond_to(:belongs_to)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should have required active_record dependencies' do
|
18
|
+
klass = Class.new(Vinaigrette::Base) do
|
19
|
+
attr_accessor :recipe_id
|
20
|
+
belongs_to :recipe
|
21
|
+
end
|
22
|
+
Object.const_set(:AnethSauce, klass)
|
23
|
+
|
24
|
+
klass = Class.new(ActiveRecord::Base)
|
25
|
+
Object.const_set(:Recipe, klass)
|
26
|
+
|
27
|
+
assert_respond_to(AnethSauce, :compute_type)
|
28
|
+
|
29
|
+
sauce = AnethSauce.new
|
30
|
+
assert_respond_to(sauce, :autosave_associated_records_for_recipe)
|
31
|
+
assert_respond_to(sauce, :recipe)
|
32
|
+
sauce.recipe
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should actually search the associated record' do
|
36
|
+
# TODO: Find a way to test this
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should serialize its attributes' do
|
40
|
+
DeliciousSauce.send(:attr_accessor, :recipe_id)
|
41
|
+
sauce = DeliciousSauce.new
|
42
|
+
|
43
|
+
assert_equal({recipe_id: nil}, sauce.serializable_hash)
|
44
|
+
|
45
|
+
sauce.recipe_id = 42
|
46
|
+
assert_equal({recipe_id: 42}, sauce.serializable_hash)
|
47
|
+
|
48
|
+
sauce.recipe_id = "MyRecipe"
|
49
|
+
assert_equal({recipe_id: "MyRecipe"}, sauce.serializable_hash)
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should support vinaigrette_accessor' do
|
53
|
+
DeliciousSauce.send(:vinaigrette_accessor, :recipe_id, Integer)
|
54
|
+
sauce = DeliciousSauce.new
|
55
|
+
|
56
|
+
sauce.recipe_id = "42"
|
57
|
+
assert_equal({recipe_id: 42}, sauce.serializable_hash)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should support default values' do
|
61
|
+
DeliciousSauce.send(:vinaigrette_accessor, :recipe_id, Integer, 42)
|
62
|
+
sauce = DeliciousSauce.new
|
63
|
+
assert_equal({recipe_id: 42}, sauce.serializable_hash)
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should support invalid casts' do
|
67
|
+
DeliciousSauce.send(:vinaigrette_accessor, :recipe_id, Integer, 42)
|
68
|
+
sauce = DeliciousSauce.new
|
69
|
+
sauce.recipe_id = false
|
70
|
+
assert_equal({recipe_id: 42}, sauce.serializable_hash)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should support default values' do
|
74
|
+
DeliciousSauce.send(:vinaigrette_accessor, :name, String, "")
|
75
|
+
sauce = DeliciousSauce.new
|
76
|
+
sauce.name = nil
|
77
|
+
assert_equal({name: ""}, sauce.serializable_hash)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should support boolean values' do
|
81
|
+
DeliciousSauce.send(:vinaigrette_accessor, :has_recipe, 'Boolean', nil)
|
82
|
+
sauce = DeliciousSauce.new
|
83
|
+
|
84
|
+
assert_equal({has_recipe: nil}, sauce.serializable_hash)
|
85
|
+
sauce.has_recipe = false
|
86
|
+
assert_equal({has_recipe: false}, sauce.serializable_hash)
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'should fail casting invalid booleans' do
|
90
|
+
assert_raises ArgumentError do
|
91
|
+
Kernel.Boolean("should not become a boolean")
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'should cast valid booleans' do
|
96
|
+
assert_equal(false, Kernel.Boolean("false"))
|
97
|
+
assert_equal(false, Kernel.Boolean("no"))
|
98
|
+
assert_equal(false, Kernel.Boolean("0"))
|
99
|
+
assert_equal(true, Kernel.Boolean("true"))
|
100
|
+
assert_equal(true, Kernel.Boolean("yes"))
|
101
|
+
assert_equal(true, Kernel.Boolean("1"))
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'should support procs' do
|
105
|
+
DeliciousSauce.send(:vinaigrette_accessor, :recipe_id, Integer, lambda { 42 })
|
106
|
+
|
107
|
+
sauce = DeliciousSauce.new
|
108
|
+
assert_equal({recipe_id: 42}, sauce.serializable_hash)
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require_relative '../../test_helper'
|
2
|
+
|
3
|
+
describe Vinaigrette::Serialize do
|
4
|
+
before do
|
5
|
+
Object.send(:remove_const, :DeliciousSauce) if Object.const_defined?(:DeliciousSauce)
|
6
|
+
Object.send(:remove_const, :SalmonDish) if Object.const_defined?(:SalmonDish)
|
7
|
+
|
8
|
+
class DeliciousSauce
|
9
|
+
def initialize attributes={}
|
10
|
+
end
|
11
|
+
end
|
12
|
+
class SalmonDish
|
13
|
+
include Vinaigrette::Serialize
|
14
|
+
end
|
15
|
+
|
16
|
+
# Mock an ActiveRecord object with validations
|
17
|
+
SalmonDish.stubs(:serialize)
|
18
|
+
SalmonDish.stubs(:before_validation)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should call successfully vinaigrette_serialize method' do
|
22
|
+
SalmonDish.send(:vinaigrette_serialize, :sauce, DeliciousSauce)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should call serialize with Hash' do
|
26
|
+
SalmonDish.expects(:serialize).with(:sauce, Hash).once
|
27
|
+
SalmonDish.send(:vinaigrette_serialize, :sauce, DeliciousSauce)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should add errors to outer model' do
|
31
|
+
SalmonDish.send(:attr_accessor, :sauce)
|
32
|
+
SalmonDish.send(:vinaigrette_serialize, :sauce, DeliciousSauce)
|
33
|
+
|
34
|
+
dish = SalmonDish.new
|
35
|
+
dish.stubs(:attributes).returns({})
|
36
|
+
|
37
|
+
sauce = DeliciousSauce.new
|
38
|
+
sauce.stubs(:valid?).returns(false)
|
39
|
+
sauce.stubs(:errors).returns([[:taste, 'should be delicious']])
|
40
|
+
DeliciousSauce.stubs(:new).returns(sauce)
|
41
|
+
|
42
|
+
error_mock = mock()
|
43
|
+
error_mock.stubs(:add).with(:sauce, 'taste should be delicious').once
|
44
|
+
dish.stubs(:errors).returns(error_mock)
|
45
|
+
|
46
|
+
dish.__validate_sauce
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should override default Hash accessor' do
|
50
|
+
SalmonDish.send(:attr_accessor, :sauce)
|
51
|
+
SalmonDish.send(:vinaigrette_serialize, :sauce, DeliciousSauce)
|
52
|
+
|
53
|
+
dish = SalmonDish.new
|
54
|
+
dish.stubs(:attributes).returns({})
|
55
|
+
|
56
|
+
assert_equal(DeliciousSauce, dish.sauce.class)
|
57
|
+
end
|
58
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter 'vendor'
|
5
|
+
add_filter 'test'
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'minitest/autorun'
|
9
|
+
require 'minitest/pride'
|
10
|
+
require "minitest/hell"
|
11
|
+
|
12
|
+
require File.expand_path('../../lib/vinaigrette.rb', __FILE__)
|
13
|
+
|
14
|
+
require 'mocha/setup'
|
data/vinaigrette.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vinaigrette/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "vinaigrette"
|
8
|
+
gem.version = Vinaigrette::VERSION
|
9
|
+
gem.authors = ["Yvan BARTHÉLEMY"]
|
10
|
+
gem.email = ["ybarthelemy@direct-streams.com"]
|
11
|
+
gem.description = %q{Custom serializable ActiveModel object.}
|
12
|
+
gem.summary = %q{Provides a custom serializable ActiveModel object with ActiveModel validations and ActiveRecord associations.}
|
13
|
+
gem.homepage = "http://ybart.github.com/vinaigrette"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_development_dependency 'rake'
|
21
|
+
gem.add_development_dependency 'minitest', '>= 4.2.0'
|
22
|
+
gem.add_development_dependency 'simplecov', '>= 0.3.8'
|
23
|
+
gem.add_development_dependency 'mocha', '>= 0.13.1'
|
24
|
+
|
25
|
+
gem.add_dependency 'activerecord', '>= 3.0.0'
|
26
|
+
# gem.add_dependency 'activesupport', '>= 3.0.0' # ActiveSupport::Concern
|
27
|
+
# gem.add_dependency 'activemodel', '>= 3.0.0' # ActiveModel::Validations
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vinaigrette
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Yvan BARTHÉLEMY
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: minitest
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 4.2.0
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 4.2.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: simplecov
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.3.8
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.3.8
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: mocha
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.13.1
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.13.1
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: activerecord
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 3.0.0
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 3.0.0
|
94
|
+
description: Custom serializable ActiveModel object.
|
95
|
+
email:
|
96
|
+
- ybarthelemy@direct-streams.com
|
97
|
+
executables: []
|
98
|
+
extensions: []
|
99
|
+
extra_rdoc_files: []
|
100
|
+
files:
|
101
|
+
- .gitignore
|
102
|
+
- Gemfile
|
103
|
+
- LICENSE.txt
|
104
|
+
- README.md
|
105
|
+
- Rakefile
|
106
|
+
- lib/vinaigrette.rb
|
107
|
+
- lib/vinaigrette/base.rb
|
108
|
+
- lib/vinaigrette/model/accessor.rb
|
109
|
+
- lib/vinaigrette/model/belongs_to.rb
|
110
|
+
- lib/vinaigrette/model/serialization.rb
|
111
|
+
- lib/vinaigrette/serialize.rb
|
112
|
+
- lib/vinaigrette/version.rb
|
113
|
+
- test/lib/vinaigrette/base_test.rb
|
114
|
+
- test/lib/vinaigrette/serialize_test.rb
|
115
|
+
- test/lib/vinaigrette/version_test.rb
|
116
|
+
- test/test_helper.rb
|
117
|
+
- vinaigrette.gemspec
|
118
|
+
homepage: http://ybart.github.com/vinaigrette
|
119
|
+
licenses: []
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ! '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 1.8.24
|
139
|
+
signing_key:
|
140
|
+
specification_version: 3
|
141
|
+
summary: Provides a custom serializable ActiveModel object with ActiveModel validations
|
142
|
+
and ActiveRecord associations.
|
143
|
+
test_files:
|
144
|
+
- test/lib/vinaigrette/base_test.rb
|
145
|
+
- test/lib/vinaigrette/serialize_test.rb
|
146
|
+
- test/lib/vinaigrette/version_test.rb
|
147
|
+
- test/test_helper.rb
|