ixtlan-babel 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f025bd8665c42f07f792f3fb8a28331a62e47274
4
+ data.tar.gz: 4c3df0b63c0574acc37ec06cd33e9f18e0c1c809
5
+ SHA512:
6
+ metadata.gz: 8b5267f3135e38b8053da3d39a30a87093ccd11f0c9e2837c3264b346dffd96613a17031f3d6ef5e98a34657652475452f12c96bcdcc81484f21021f01ce2dec
7
+ data.tar.gz: f1be049f637b3dd246fb4f8353f71662e3e3bfd8fe806d3514c82b74f80e839723ed9345b4d5e2cce38c6d290397d2f9eaf59bd36b7bfcff3d61b2bc6713a494
data/Gemfile CHANGED
@@ -2,5 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'copyright-header', '~> 1.0', :platform => :mri
5
+ gem 'copyright-header', '~> 1.0', :platform => :mri, :group => :copyright
6
6
 
@@ -51,8 +51,10 @@ module Ixtlan
51
51
  result[ k ] = filter_data( v,
52
52
  context[ k ] ) if context.include?( k )
53
53
  when Array
54
- result[ k ] = filter_array( v,
55
- context[ k ] ) if context.include?( k )
54
+ if context.allowed?( k ) || context.include?( k )
55
+ result[ k ] = filter_array( v,
56
+ context[ k ] )
57
+ end
56
58
  else
57
59
  result[ k ] = serialize( v ) if context.allowed?( k )
58
60
  end
@@ -45,12 +45,42 @@ module Ixtlan
45
45
  config.default_context_key(default)
46
46
  end
47
47
 
48
- def self.add_context(key, options = {})
49
- config[key] = options
48
+ def self.add_context( key = :single, options = nil, &block )
49
+ current = config[key] = options || { :only => [] }
50
+ @context = key
51
+ yield if block
52
+ current[ :keep ] = @keep if @keep
53
+ current.merge!( @allow ) if @allow
54
+ current[ :root ] = @root
55
+ ensure
56
+ @context = nil
57
+ @allow = nil
58
+ @keep = nil
59
+ @root = nil
50
60
  end
51
61
 
52
62
  def self.root( root )
53
- config.root = root
63
+ if @context
64
+ @root = root
65
+ else
66
+ config.root = root
67
+ end
68
+ end
69
+
70
+ def self.keep( *args )
71
+ @keep = *args
72
+ end
73
+
74
+ def self.only( *args )
75
+ result = {}
76
+ if args.last.is_a? Hash
77
+ result[ :include ] = args.last
78
+ result[ :only ] = args[ 0..-2 ]
79
+ else
80
+ result[ :only ] = args
81
+ end
82
+ @allow = result
83
+ result
54
84
  end
55
85
 
56
86
  public
@@ -72,6 +102,10 @@ module Ixtlan
72
102
  @model.send( :new, params )
73
103
  end
74
104
 
105
+ def []( key )
106
+ params[ key ]
107
+ end
108
+
75
109
  def params
76
110
  @data[ :params ]
77
111
  end
@@ -105,6 +139,8 @@ module Ixtlan
105
139
  ( filter.options[ :keep ] || [] ).each do |k|
106
140
  keeps[ k.to_s ] = filtered_data.delete( k.to_s ) ||
107
141
  filtered_data.delete( k.to_sym ) unless keeps.member?( k.to_s )
142
+ # just make sure we have an entry for each keeps key
143
+ keeps[ k.to_s ] ||= nil
108
144
  end
109
145
  FilterResult.new( @model_class, filtered_data, keeps )
110
146
  end
@@ -77,12 +77,37 @@ module Ixtlan
77
77
  config.default_context_key(single, collection)
78
78
  end
79
79
 
80
- def self.add_context(key, options = {})
81
- config[key] = options
80
+ def self.add_context(key = :single, options = nil, &block)
81
+ current = config[key] = options || { :only => Array.new }
82
+ @only = nil
83
+ @root = nil
84
+ @context = key
85
+ yield if block
86
+ current.merge!( @only ) if @only
87
+ current[ :root ] = @root
88
+ ensure
89
+ @context = nil
90
+ end
91
+
92
+ def self.only( *args )
93
+ args.flatten!
94
+ result = { :only => Array.new }
95
+ if args.last.is_a? Hash
96
+ result[ :include ] = args.last
97
+ result[ :methods ] = args[ 0..-2 ]
98
+ else
99
+ result[ :methods ] = args
100
+ end
101
+ @only = result
102
+ result
82
103
  end
83
104
 
84
105
  def self.root( root )
85
- config.root = root
106
+ if @context
107
+ @root = root
108
+ else
109
+ config.root = root
110
+ end
86
111
  end
87
112
 
88
113
  public
@@ -4,7 +4,7 @@ class Hash
4
4
  def attributes
5
5
  self
6
6
  end
7
- def method_missing(method)
7
+ def method_missing(method, *args)
8
8
  self[method.to_s]
9
9
  end
10
10
  end
@@ -0,0 +1,173 @@
1
+ require 'spec_helper'
2
+ require 'virtus'
3
+
4
+ class Address2
5
+ include Virtus
6
+
7
+ attribute :street, String
8
+ attribute :zipcode, String
9
+ end
10
+ class Area2
11
+ include Virtus
12
+
13
+ attribute :code, String
14
+ attribute :iso, String
15
+ end
16
+ class PhoneNumber2
17
+ include Virtus
18
+
19
+ attribute :prefix, Integer
20
+ attribute :number, String
21
+ attribute :area, Area2
22
+ end
23
+ class Person2
24
+ include Virtus
25
+
26
+ attribute :id, String
27
+ attribute :name, String
28
+ attribute :address, Address2
29
+
30
+ attr_accessor :phone_numbers, :age, :children_names
31
+
32
+ def phone_numbers
33
+ @phone_numbers ||= [PhoneNumber2.new(
34
+ :prefix => 12,
35
+ :number => '123',
36
+ :area => Area2.new( :code => '001', :iso => 'us' ) )]
37
+ end
38
+
39
+ def age
40
+ @age ||= 123
41
+ end
42
+
43
+ def children_names
44
+ @children_names ||= ['anna', 'jack', 'rama', 'mia']
45
+ end
46
+
47
+ def children_ages
48
+ @children_ages ||= [12, 3, 6, 9]
49
+ end
50
+ end
51
+
52
+ describe Ixtlan::Babel::ModelFilter.to_s + ':with_methods' do
53
+ let( :person ) do
54
+ Person2.new( :id => 987,
55
+ :name => 'me and the corner',
56
+ :address => Address2.new( :street => 'Foo 12',
57
+ :zipcode => '12345' ) )
58
+ end
59
+
60
+ let( :serializer ) { factory.new_serializer( person ) }
61
+
62
+ let( :factory ) { Ixtlan::Babel::Factory.new }
63
+
64
+ it 'should serialize and deserialize with methods' do
65
+ class Person2Serializer < Ixtlan::Babel::Serializer
66
+ add_context( :nested ) do
67
+ only :id, :name, :age, :children_names, :children_ages
68
+ end
69
+ end
70
+ json = serializer.use( :nested ).to_json
71
+ result = MultiJson.load(json)
72
+ result.must_equal Hash[ "id"=>"987",
73
+ "name"=>"me and the corner",
74
+ "age"=>123,
75
+ "children_names"=> [ "anna",
76
+ "jack",
77
+ "rama",
78
+ "mia" ],
79
+ "children_ages"=>[ 12, 3, 6, 9 ] ]
80
+ end
81
+
82
+ it 'should serialize and deserialize without root' do
83
+ class Person2Serializer < Ixtlan::Babel::Serializer
84
+ add_context( :plain ) do
85
+ only :id, :name
86
+ end
87
+ end
88
+ json = serializer.use( :plain ).to_json
89
+ result = MultiJson.load(json)
90
+ result.must_equal Hash[ "id"=>"987", "name"=>"me and the corner" ]
91
+ end
92
+
93
+ it 'should serialize and deserialize with root' do
94
+ class Person2Serializer < Ixtlan::Babel::Serializer
95
+ add_context( :root ) do
96
+ root 'my'
97
+ only :id, :name
98
+ end
99
+ end
100
+ json = serializer.use( :root ).to_json
101
+ result = MultiJson.load(json)[ 'my' ]
102
+ result.must_equal Hash[ "id"=>"987", "name"=>"me and the corner" ]
103
+ end
104
+
105
+ it 'should serialize and deserialize a hash with include list' do
106
+ class Person2Serializer < Ixtlan::Babel::Serializer
107
+ add_context( :deep_nested) do
108
+ only( :id, :name,
109
+ :address => only( :street, :zipcode ),
110
+ :phone_numbers => only( :prefix, :number ) )
111
+ end
112
+ end
113
+ json = serializer.use( :deep_nested ).to_json
114
+ result = MultiJson.load(json)
115
+ result.must_equal Hash[ "id"=>"987", "name"=>"me and the corner" ,
116
+ "address"=> {
117
+ "street"=>"Foo 12",
118
+ "zipcode"=>"12345"
119
+ },
120
+ "phone_numbers"=> [ { "prefix"=>12,
121
+ "number"=>"123" } ] ]
122
+ end
123
+
124
+ it 'should serialize and deserialize with only' do
125
+ class Person2Serializer < Ixtlan::Babel::Serializer
126
+ add_context( :only ) do
127
+ only :name
128
+ end
129
+ end
130
+ json = serializer.use( :only ).to_json
131
+ result = MultiJson.load(json)
132
+ result.must_equal Hash[ "name"=>"me and the corner" ]
133
+ end
134
+
135
+ it 'should serialize and deserialize with nested only' do
136
+ class Person2Serializer < Ixtlan::Babel::Serializer
137
+ add_context( :nested_only ) do
138
+ only :address => only( :street )
139
+ end
140
+ end
141
+ json = serializer.use( :nested_only ).to_json
142
+ result = MultiJson.load(json)
143
+ result.must_equal Hash[ "address"=> {
144
+ "street"=>"Foo 12"
145
+ } ]
146
+ end
147
+
148
+ it 'should serialize and deserialize with nested include' do
149
+ class Person2Serializer < Ixtlan::Babel::Serializer
150
+ add_context( :nested_deep ) do
151
+ only( :id, :name,
152
+ :address => only( :street, :zipcode ),
153
+ :phone_numbers => only( :prefix,
154
+ :number,
155
+ :area => only( :code, :iso) ) )
156
+ end
157
+ end
158
+ json = serializer.use( :nested_deep ).to_json
159
+ result = MultiJson.load(json)
160
+ result.must_equal Hash[ "id"=>"987", "name"=>"me and the corner" ,
161
+ "address"=> {
162
+ "street"=>"Foo 12",
163
+ "zipcode"=>"12345"
164
+ },
165
+ "phone_numbers"=> [ { "prefix"=>12,
166
+ "number"=>"123",
167
+ "area"=> {
168
+ "code"=>"001",
169
+ "iso"=>"us"
170
+ }
171
+ } ] ]
172
+ end
173
+ end
@@ -0,0 +1,134 @@
1
+ require 'spec_helper'
2
+ require 'ixtlan/babel/params_filter'
3
+
4
+ class A; end
5
+ class AFilter < Ixtlan::Babel::ParamsFilter
6
+
7
+ end
8
+
9
+ class Hash
10
+ def attributes
11
+ self
12
+ end
13
+ def method_missing(method)
14
+ self[method.to_s]
15
+ end
16
+ end
17
+
18
+ describe Ixtlan::Babel::ParamsFilter do
19
+ let(:data) do
20
+ {
21
+ 'id' => 987,
22
+ 'name' => 'me and the corner',
23
+ 'address' => { 'street' => 'Foo 12', 'zipcode' => '12345' },
24
+ 'list' => [1,2,3,4],
25
+ 'phone_numbers' => {
26
+ 'prefix' => 12,
27
+ 'number' => '123',
28
+ 'area' => { 'code' => '001', 'iso' => 'us'}
29
+ }
30
+ }
31
+ end
32
+
33
+ let(:factory) { Ixtlan::Babel::Factory.new }
34
+ let(:filter) { factory.new_filter( A ) }
35
+ let(:deserializer) { Ixtlan::Babel::Deserializer.new(Hash) }
36
+
37
+ it 'should filter a hash' do
38
+ AFilter.add_context( :plain )
39
+ result = filter.use( :plain ).filter_it( data )
40
+ result.params.must_equal Hash[]
41
+ result.size.must_equal 1
42
+ end
43
+
44
+ it 'should filter a hash with keep' do
45
+ class AFilter
46
+ add_context( :keep ) do
47
+ keep :id
48
+ end
49
+ end
50
+ result = filter.use( :keep ).filter_it( data )
51
+ result.params.must_equal Hash[]
52
+ result.id.must_equal data['id']
53
+ result.size.must_equal 2
54
+ end
55
+
56
+ it 'should filter a hash with root' do
57
+ class AFilter
58
+ add_context( :root ) do
59
+ root 'my'
60
+ only :id, :name
61
+ end
62
+ end
63
+ result = filter.use( :root ).filter_it( 'my' => data )
64
+ result.params.must_equal Hash[ 'id' => data['id'], 'name' => data['name'] ]
65
+ result.size.must_equal 1
66
+ end
67
+
68
+ it 'should filter a nested object' do
69
+ class AFilter
70
+ add_context( :nested ) do
71
+ only( :id, :name,
72
+ :address => only( :street, :zipcode),
73
+ :phone_numbers => only( :prefix, :number ) )
74
+ end
75
+ end
76
+ result = filter.use( :nested ).filter_it( data )
77
+
78
+ data['phone_numbers'].delete('area')
79
+ data.delete('list')
80
+ result.params.must_equal Hash[data]
81
+ result.size.must_equal 1
82
+ end
83
+
84
+ it 'should filter a hash with only' do
85
+ class AFilter
86
+ add_context( :only ) do
87
+ only :name
88
+ end
89
+ end
90
+ result = filter.use( :only ).filter_it( data )
91
+ result.params.must_equal Hash['name' => data['name']]
92
+ result.size.must_equal 1
93
+ end
94
+
95
+ it 'should filter a hash with only and keep' do
96
+ class AFilter
97
+ add_context( :only_and_keep ) do
98
+ keep :id
99
+ only :name
100
+ end
101
+ end
102
+ result = filter.use( :only_and_keep ).filter_it( data )
103
+ result.params.must_equal Hash['name' => data['name']]
104
+ result.id.must_equal data['id']
105
+ result.size.must_equal 2
106
+ end
107
+
108
+ it 'should filter a hash with nested only' do
109
+ class AFilter
110
+ add_context( :filtered_nested ) do
111
+ only :id, :name, :list, :address => only( :street )
112
+ end
113
+ end
114
+ result = filter.use( :filtered_nested ).filter_it( data )
115
+ data.delete('phone_numbers')
116
+ data['address'].delete('zipcode')
117
+ result.params.must_equal Hash[data]
118
+ result.size.must_equal 1
119
+ end
120
+
121
+ it 'should filter a hash with deep nested include' do
122
+ class AFilter
123
+ add_context( :deep_nested ) do
124
+ only( :id, :name, :list,
125
+ :address => only( :street, :zipcode),
126
+ :phone_numbers => only( :prefix, :number,
127
+ :area => only( :code, :iso ) ) )
128
+ end
129
+ end
130
+ result = filter.use( :deep_nested ).filter_it( data )
131
+ result.params.must_equal Hash[data]
132
+ result.size.must_equal 1
133
+ end
134
+ end
@@ -0,0 +1,113 @@
1
+ require 'spec_helper'
2
+ require 'ixtlan/babel/params_filter'
3
+
4
+ class A; end
5
+ class AFilter < Ixtlan::Babel::ParamsFilter
6
+
7
+ end
8
+
9
+ class Hash
10
+ def attributes
11
+ self
12
+ end
13
+ def method_missing(method)
14
+ self[method.to_s]
15
+ end
16
+ end
17
+
18
+ describe Ixtlan::Babel::ParamsFilter do
19
+ let(:data) do
20
+ {
21
+ 'id' => 987,
22
+ 'name' => 'me and the corner',
23
+ 'address' => { 'street' => 'Foo 12', 'zipcode' => '12345' },
24
+ 'phone_numbers' => {
25
+ 'prefix' => 12,
26
+ 'number' => '123',
27
+ 'area' => { 'code' => '001', 'iso' => 'us'}
28
+ }
29
+ }
30
+ end
31
+
32
+ let(:factory) { Ixtlan::Babel::Factory.new }
33
+ let(:filter) { factory.new_filter( A ) }
34
+ let(:deserializer) { Ixtlan::Babel::Deserializer.new(Hash) }
35
+
36
+ it 'should filter a hash' do
37
+ result = filter.filter_it( data )
38
+ result.params.must_equal Hash[ 'id' => data['id'], 'name' => data['name'] ]
39
+ result.size.must_equal 1
40
+ end
41
+
42
+ it 'should filter a hash with keep' do
43
+ result = filter.use( :keep => ['id'] ).filter_it( data )
44
+ result.params.must_equal Hash[ 'name' => data['name'] ]
45
+ result.id.must_equal data['id']
46
+ result.size.must_equal 2
47
+ end
48
+
49
+ it 'should filter a hash with root' do
50
+ result = filter.use( :root => 'my' ).filter_it( 'my' => data )
51
+ result.params.must_equal Hash[ 'id' => data['id'], 'name' => data['name'] ]
52
+ result.size.must_equal 1
53
+ end
54
+
55
+ it 'should filter a hash with include list' do
56
+ result = filter.use( :include => ['address',
57
+ 'phone_numbers'] ).filter_it( data )
58
+
59
+ data['phone_numbers'].delete('area')
60
+ result.params.must_equal Hash[data]
61
+ result.size.must_equal 1
62
+ end
63
+
64
+ it 'should filter a hash with except' do
65
+ result = filter.use( :except => ['id'] ).filter_it( data )
66
+ result.params.must_equal Hash['name' => data['name']]
67
+ result.size.must_equal 1
68
+ end
69
+
70
+ it 'should filter a hash with except and keep' do
71
+ result = filter.use( :except => ['id'], :keep => ['id'] ).filter_it( data )
72
+ result.params.must_equal Hash['name' => data['name']]
73
+ result.id.must_equal data['id']
74
+ end
75
+
76
+ it 'should filter a hash with only' do
77
+ result = filter.use( :only => ['name'] ).filter_it( data )
78
+ result.params.must_equal Hash['name' => data['name']]
79
+ result.size.must_equal 1
80
+ end
81
+
82
+ it 'should filter a hash with only and keep' do
83
+ result = filter.use( :only => ['name'], :keep => ['id'] ).filter_it( data )
84
+ result.params.must_equal Hash['name' => data['name']]
85
+ result.id.must_equal data['id']
86
+ result.size.must_equal 2
87
+ end
88
+
89
+ it 'should filter a hash with nested only' do
90
+ result = filter.use( :include => { 'address' =>
91
+ {:only => ['street']}} ).filter_it( data )
92
+ data.delete('phone_numbers')
93
+ data['address'].delete('zipcode')
94
+ result.params.must_equal Hash[data]
95
+ result.size.must_equal 1
96
+ end
97
+
98
+ it 'should filter a hash with nested except' do
99
+ result = filter.use( :include => { 'address' =>
100
+ {:except => ['zipcode']}} ).filter_it( data )
101
+ data.delete('phone_numbers')
102
+ data['address'].delete('zipcode')
103
+ result.params.must_equal Hash[data]
104
+ result.size.must_equal 1
105
+ end
106
+
107
+ it 'should filter a hash with nested include' do
108
+ result = filter.use( :include => { 'address' => {}, 'phone_numbers' =>
109
+ { :include => ['area']}} ).filter_it( data )
110
+ result.params.must_equal Hash[data]
111
+ result.size.must_equal 1
112
+ end
113
+ end
@@ -42,7 +42,7 @@ describe Ixtlan::Babel::ParamsFilter do
42
42
  it 'should filter a hash with keep' do
43
43
  result = filter.use( :keep => ['id'] ).filter_it( data )
44
44
  result.params.must_equal Hash[ 'name' => data['name'] ]
45
- result[ 'id' ].must_equal data['id']
45
+ result.id.must_equal data['id']
46
46
  result.size.must_equal 2
47
47
  end
48
48
 
@@ -70,7 +70,7 @@ describe Ixtlan::Babel::ParamsFilter do
70
70
  it 'should filter a hash with except and keep' do
71
71
  result = filter.use( :except => ['id'], :keep => ['id'] ).filter_it( data )
72
72
  result.params.must_equal Hash['name' => data['name']]
73
- result['id'].must_equal data['id']
73
+ result.id.must_equal data['id']
74
74
  end
75
75
 
76
76
  it 'should filter a hash with only' do
@@ -82,7 +82,7 @@ describe Ixtlan::Babel::ParamsFilter do
82
82
  it 'should filter a hash with only and keep' do
83
83
  result = filter.use( :only => ['name'], :keep => ['id'] ).filter_it( data )
84
84
  result.params.must_equal Hash['name' => data['name']]
85
- result[ 'id' ].must_equal data['id']
85
+ result.id.must_equal data['id']
86
86
  result.size.must_equal 2
87
87
  end
88
88
 
@@ -1,4 +1,5 @@
1
1
  $LOAD_PATH << File.expand_path(File.join(__FILE__, '..', '..', 'lib'))
2
+ gem 'minitest'
2
3
  require 'minitest/autorun'
3
4
  require 'json'
4
5
  require 'ixtlan-babel'
metadata CHANGED
@@ -1,94 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ixtlan-babel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
5
- prerelease:
4
+ version: 0.5.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Christian Meier
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-08 00:00:00.000000000 Z
11
+ date: 2013-12-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  version_requirements: !ruby/object:Gem::Requirement
17
16
  requirements:
18
- - - "~>"
17
+ - - ~>
19
18
  - !ruby/object:Gem::Version
20
19
  version: '10.0'
21
- none: false
22
20
  requirement: !ruby/object:Gem::Requirement
23
21
  requirements:
24
- - - "~>"
22
+ - - ~>
25
23
  - !ruby/object:Gem::Version
26
24
  version: '10.0'
27
- none: false
28
25
  prerelease: false
29
26
  type: :development
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: minitest
32
29
  version_requirements: !ruby/object:Gem::Requirement
33
30
  requirements:
34
- - - "~>"
31
+ - - ~>
35
32
  - !ruby/object:Gem::Version
36
33
  version: '4.0'
37
- none: false
38
34
  requirement: !ruby/object:Gem::Requirement
39
35
  requirements:
40
- - - "~>"
36
+ - - ~>
41
37
  - !ruby/object:Gem::Version
42
38
  version: '4.0'
43
- none: false
44
39
  prerelease: false
45
40
  type: :development
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: virtus
48
43
  version_requirements: !ruby/object:Gem::Requirement
49
44
  requirements:
50
- - - "~>"
45
+ - - ~>
51
46
  - !ruby/object:Gem::Version
52
47
  version: '0.5'
53
- none: false
54
48
  requirement: !ruby/object:Gem::Requirement
55
49
  requirements:
56
- - - "~>"
50
+ - - ~>
57
51
  - !ruby/object:Gem::Version
58
52
  version: '0.5'
59
- none: false
60
53
  prerelease: false
61
54
  type: :development
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: multi_json
64
57
  version_requirements: !ruby/object:Gem::Requirement
65
58
  requirements:
66
- - - "~>"
59
+ - - ~>
67
60
  - !ruby/object:Gem::Version
68
61
  version: '1.6'
69
- none: false
70
62
  requirement: !ruby/object:Gem::Requirement
71
63
  requirements:
72
- - - "~>"
64
+ - - ~>
73
65
  - !ruby/object:Gem::Version
74
66
  version: '1.6'
75
- none: false
76
67
  prerelease: false
77
68
  type: :development
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: json
80
71
  version_requirements: !ruby/object:Gem::Requirement
81
72
  requirements:
82
- - - "~>"
73
+ - - ~>
83
74
  - !ruby/object:Gem::Version
84
75
  version: '1.7'
85
- none: false
86
76
  requirement: !ruby/object:Gem::Requirement
87
77
  requirements:
88
- - - "~>"
78
+ - - ~>
89
79
  - !ruby/object:Gem::Version
90
80
  version: '1.7'
91
- none: false
92
81
  prerelease: false
93
82
  type: :development
94
83
  description: babel offers a filter for hashes and with that comes json/yaml/xml de/serialization of models which provides a hash representationi. possible models are activerecord, activemodel, resources from datamapper, virtus
@@ -99,68 +88,70 @@ extensions: []
99
88
  extra_rdoc_files: []
100
89
  files:
101
90
  - lib/ixtlan-babel.rb
102
- - lib/ixtlan/babel/dm_validation_errors_serializer.rb~
103
- - lib/ixtlan/babel/context.rb~
104
- - lib/ixtlan/babel/filter_config.rb~
105
- - lib/ixtlan/babel/context.rb
106
- - lib/ixtlan/babel/hash_only_filter.rb~
107
- - lib/ixtlan/babel/hash_filter.rb
108
- - lib/ixtlan/babel/abstract_filter.rb~
109
- - lib/ixtlan/babel/serializer.rb~
110
- - lib/ixtlan/babel/serializer.rb
111
- - lib/ixtlan/babel/factory.rb~
112
91
  - lib/ixtlan/babel/config.rb~
92
+ - lib/ixtlan/babel/filter_config.rb
93
+ - lib/ixtlan/babel/params_filter.rb~
94
+ - lib/ixtlan/babel/model_filter.rb
95
+ - lib/ixtlan/babel/dm_validation_errors_serializer.rb~
96
+ - lib/ixtlan/babel/hash_filter.rb~
113
97
  - lib/ixtlan/babel/params_filter.rb
98
+ - lib/ixtlan/babel/serializer.rb~
114
99
  - lib/ixtlan/babel/factory.rb
100
+ - lib/ixtlan/babel/abstract_filter.rb~
101
+ - lib/ixtlan/babel/hash_only_filter.rb~
102
+ - lib/ixtlan/babel/context.rb
103
+ - lib/ixtlan/babel/dm_validation_errors_serializer.rb
115
104
  - lib/ixtlan/babel/model_filter.rb~
116
- - lib/ixtlan/babel/model_filter.rb
117
- - lib/ixtlan/babel/params_filter.rb~
118
- - lib/ixtlan/babel/filter_config.rb
105
+ - lib/ixtlan/babel/serializer.rb
106
+ - lib/ixtlan/babel/filter_config.rb~
107
+ - lib/ixtlan/babel/context.rb~
119
108
  - lib/ixtlan/babel/abstract_filter.rb
120
- - lib/ixtlan/babel/dm_validation_errors_serializer.rb
121
- - lib/ixtlan/babel/hash_filter.rb~
122
- - spec/model_filter_spec.rb
109
+ - lib/ixtlan/babel/factory.rb~
110
+ - lib/ixtlan/babel/hash_filter.rb
111
+ - spec/params_filter_dsl_spec.rb
112
+ - spec/model_filter_spec.rb~
113
+ - spec/params_filter_spec.rb~
114
+ - spec/model_filter_with_methods_spec.rb~
123
115
  - spec/params_filter_spec.rb
124
- - spec/model_filter_with_methods_spec.rb
116
+ - spec/params_filter_dsl_spec.rb~
125
117
  - spec/hash_filter_spec.rb~
118
+ - spec/model_filter_with_dsl_spec.rb
119
+ - spec/model_filter_with_methods_spec.rb
126
120
  - spec/spec_helper.rb
127
- - spec/model_filter_with_methods.spec.rb~
128
- - spec/params_filter_spec.rb~
129
121
  - spec/hash_filter_spec.rb
130
- - spec/model_filter_with_methods_spec.rb~
131
- - spec/model_filter_spec.rb~
122
+ - spec/model_filter_with_methods.spec.rb~
123
+ - spec/model_filter_spec.rb
132
124
  - MIT-LICENSE
133
125
  - README.md
134
126
  - Gemfile
135
127
  homepage: https://github.com/mkristian/ixtlan-babel
136
128
  licenses:
137
129
  - MIT
130
+ metadata: {}
138
131
  post_install_message:
139
132
  rdoc_options: []
140
133
  require_paths:
141
134
  - lib
142
135
  required_ruby_version: !ruby/object:Gem::Requirement
143
136
  requirements:
144
- - - ">="
137
+ - - '>='
145
138
  - !ruby/object:Gem::Version
146
- version: !binary |-
147
- MA==
148
- none: false
139
+ version: '0'
149
140
  required_rubygems_version: !ruby/object:Gem::Requirement
150
141
  requirements:
151
- - - ">="
142
+ - - '>='
152
143
  - !ruby/object:Gem::Version
153
- version: !binary |-
154
- MA==
155
- none: false
144
+ version: '0'
156
145
  requirements: []
157
146
  rubyforge_project:
158
- rubygems_version: 1.8.24
147
+ rubygems_version: 2.1.9
159
148
  signing_key:
160
- specification_version: 3
149
+ specification_version: 4
161
150
  summary: babel offers a filter for hashes and with that comes json/yaml/xml de/serialization of models which provides a hash representation
162
151
  test_files:
163
- - spec/model_filter_spec.rb
152
+ - spec/params_filter_dsl_spec.rb
164
153
  - spec/params_filter_spec.rb
154
+ - spec/model_filter_with_dsl_spec.rb
165
155
  - spec/model_filter_with_methods_spec.rb
166
156
  - spec/hash_filter_spec.rb
157
+ - spec/model_filter_spec.rb