roar 0.11.11 → 0.11.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ # 0.11.12
2
+
3
+ * Moved `::inheritable_array` from `Hypermedia` to `Representer`.
4
+
1
5
  # 0.11.11
2
6
 
3
7
  * Allow use of `::link(string)`.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 - 2013 Nick Sutterer and the roar contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -2,12 +2,39 @@ require 'representable'
2
2
 
3
3
  module Roar
4
4
  module Representer
5
+ # TODO: move to separate module
6
+ # DISCUSS: experimental. this will soon be moved to a separate gem
7
+ module InheritableArray
8
+ def representable_attrs
9
+ super.extend(ConfigExtensions)
10
+ end
11
+
12
+ module ConfigExtensions
13
+ def inheritable_array(name)
14
+ inheritable_arrays[name] ||= []
15
+ end
16
+ def inheritable_arrays
17
+ @inheritable_arrays ||= {}
18
+ end
19
+
20
+ def inherit(parent)
21
+ super
22
+
23
+ parent.inheritable_arrays.keys.each do |k|
24
+ inheritable_array(k).push *parent.inheritable_array(k).clone
25
+ end
26
+ end
27
+ end
28
+ end
29
+
5
30
  def self.included(base)
6
31
  base.class_eval do
7
32
  include Representable
8
33
  end
9
34
  end
10
35
 
36
+ include InheritableArray
37
+
11
38
  private
12
39
  def before_serialize(*)
13
40
  end
@@ -154,31 +154,6 @@ module Roar
154
154
  marshal_load(hash.inject({}) { |h, (k,v)| h[k.to_sym] = v; h })
155
155
  end
156
156
  end
157
-
158
- # TODO: move to separate module
159
- # DISCUSS: experimental. this will soon be moved to a separate gem
160
- module InheritableArray
161
- def representable_attrs
162
- super.extend(ConfigExtensions)
163
- end
164
-
165
- module ConfigExtensions
166
- def inheritable_array(name)
167
- inheritable_arrays[name] ||= []
168
- end
169
- def inheritable_arrays
170
- @inheritable_arrays ||= {}
171
- end
172
-
173
- def inherit(parent)
174
- super
175
-
176
- parent.inheritable_arrays.keys.each do |k|
177
- inheritable_array(k).push *parent.inheritable_array(k).clone
178
- end
179
- end
180
- end
181
- end
182
157
  end
183
158
  end
184
159
  end
@@ -1,3 +1,3 @@
1
1
  module Roar
2
- VERSION = "0.11.11"
2
+ VERSION = "0.11.12"
3
3
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.homepage = "http://rubygems.org/gems/roar"
12
12
  s.summary = %q{Resource-oriented architectures in Ruby.}
13
13
  s.description = %q{Streamlines the development of RESTful, resource-oriented architectures in Ruby.}
14
-
14
+ s.license = 'MIT'
15
15
  s.rubyforge_project = "roar"
16
16
 
17
17
  s.files = `git ls-files`.split("\n")
@@ -218,6 +218,23 @@ class HyperlinkTest < MiniTest::Spec
218
218
 
219
219
  end.representable_attrs.inheritable_array(:links).must_equal(["bar", "stadium"])
220
220
  end
221
+
222
+ it "doesn't mess up with inheritable_array" do # FIXME: remove this test when uber is out.
223
+ OpenStruct.new.extend( Module.new do
224
+ include Roar::Representer::JSON
225
+ include Module.new do
226
+ include Roar::Representer::JSON
227
+ include Roar::Representer::Feature::Hypermedia
228
+
229
+ property :bla
230
+
231
+ link( :self) {"bo"}
232
+ end
233
+ property :blow
234
+ end).to_json
235
+
236
+
237
+ end
221
238
  end
222
239
  end
223
240
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.11
4
+ version: 0.11.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-26 00:00:00.000000000 Z
12
+ date: 2013-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: representable
@@ -87,6 +87,7 @@ files:
87
87
  - .travis.yml
88
88
  - CHANGES.markdown
89
89
  - Gemfile
90
+ - LICENSE
90
91
  - README.textile
91
92
  - Rakefile
92
93
  - TODO.markdown
@@ -122,7 +123,8 @@ files:
122
123
  - test/test_helper.rb
123
124
  - test/xml_representer_test.rb
124
125
  homepage: http://rubygems.org/gems/roar
125
- licenses: []
126
+ licenses:
127
+ - MIT
126
128
  post_install_message:
127
129
  rdoc_options: []
128
130
  require_paths: