representable 2.4.0.rc4 → 2.4.0.rc5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +7 -0
- data/lib/representable/binding.rb +6 -3
- data/lib/representable/deprecations.rb +13 -2
- data/lib/representable/insert.rb +3 -3
- data/lib/representable/pipeline.rb +3 -4
- data/lib/representable/version.rb +1 -1
- data/representable.gemspec +25 -23
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2344bb3bc4adbb5cbd3f0f920e70caac2159b017
|
4
|
+
data.tar.gz: 4a3fce1275ac3b335f1a8c211c20d4096d067a40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3a65a2f4ad0968bb128552e60f6f2e0c27b5914ce3f8f159ac05e52f3a9fb2fdcda7d9c8b0cef72f661aeb4670e6baf811861da2889a0816eef7891c2b6a426
|
7
|
+
data.tar.gz: 750cf2b8042556afc0e440e1cf7304ee42f6326c3ff0fe730d5eeb8e438b8024aaffd1460283a2c179b78d8d9e777c126bd29922888cb934d80cfa6a27b24a3c
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# 2.4.0
|
2
2
|
|
3
|
+
Full migration guide here: http://trailblazer.to/gems/representable/upgrading-guide.html#to-24
|
4
|
+
|
3
5
|
* Breaking API change: `:parse_filter` and `:render_filter` have no deprecation as all the other, they receive one options.
|
4
6
|
render_filter: val, doc, options
|
5
7
|
* `Decorator` always needs a format engine included, e.g. `Representable::JSON` to build bindings at compile-time.
|
@@ -44,6 +46,11 @@ and it suddenly is super simple to understand
|
|
44
46
|
* Removed `Binding@represented` (which was never public anyway). Use `Binding#represented`.
|
45
47
|
* Changed signature: `Binding#get(represented:)`. In now needs a hash `{represented: ..}`.
|
46
48
|
|
49
|
+
# 2.4.0.rc5
|
50
|
+
|
51
|
+
* Fix double definition of `Insert`.
|
52
|
+
* Deprecate `:binding`.
|
53
|
+
|
47
54
|
# 2.4.0.rc4
|
48
55
|
|
49
56
|
* The preferred way of passing user options is now `to_hash(user_options: {})`.
|
@@ -6,10 +6,13 @@ module Representable
|
|
6
6
|
class FragmentNotFound
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
module ClassDeprecatable
|
10
|
+
def build(definition)
|
11
|
+
return definition.create_binding if definition[:binding]
|
12
|
+
build_for(definition)
|
13
|
+
end
|
12
14
|
end
|
15
|
+
extend ClassDeprecatable
|
13
16
|
|
14
17
|
def initialize(definition)
|
15
18
|
@definition = definition
|
@@ -10,12 +10,11 @@ module Representable::Deprecation
|
|
10
10
|
|
11
11
|
options = options.dup
|
12
12
|
|
13
|
-
user_option_keys = options.keys - [:exclude, :include, :wrap, :user_options, * representable_attrs.keys.map(&:to_sym)]
|
13
|
+
user_option_keys = options.keys - [:doc, :exclude, :include, :wrap, :user_options, * representable_attrs.keys.map(&:to_sym)]
|
14
14
|
if user_option_keys.any?
|
15
15
|
user_options = {}
|
16
16
|
warn "[Representable] Mixing user and representable options is deprecated. Please provide your options via :user_options."
|
17
17
|
user_option_keys.each { |key| user_options[key] = options.delete(key) }
|
18
|
-
|
19
18
|
options[:user_options] = user_options
|
20
19
|
end
|
21
20
|
|
@@ -25,9 +24,21 @@ module Representable::Deprecation
|
|
25
24
|
end
|
26
25
|
|
27
26
|
module Representable::Binding::Deprecation
|
27
|
+
module Build
|
28
|
+
def build(definition)
|
29
|
+
warn "[Representable] The :binding option is deprecated and will be removed in 3.0. Please use your own pipeline instead." if definition[:binding]
|
30
|
+
super
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
28
34
|
Options = Struct.new(:binding, :user_options, :represented, :decorator)
|
29
35
|
|
30
36
|
module EvaluateOption
|
37
|
+
def self.included(includer)
|
38
|
+
super
|
39
|
+
includer.extend(Build)
|
40
|
+
end
|
41
|
+
|
31
42
|
def evaluate_option(name, input=nil, options={})
|
32
43
|
return evaluate_option_with_deprecation(name, input, options, :user_options) if name==:as
|
33
44
|
return evaluate_option_with_deprecation(name, input, options, :user_options) if name==:if
|
data/lib/representable/insert.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Representable
|
2
|
-
Pipeline
|
2
|
+
class Pipeline < Array # i hate that.
|
3
3
|
module Function
|
4
4
|
class Insert
|
5
5
|
def call(arr, func, options)
|
@@ -32,7 +32,7 @@ module Representable
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
35
|
-
end
|
36
35
|
|
37
|
-
|
36
|
+
Insert = Pipeline::Function::Insert.new
|
37
|
+
end # Pipeline
|
38
38
|
end
|
@@ -21,15 +21,14 @@ module Representable
|
|
21
21
|
end
|
22
22
|
|
23
23
|
|
24
|
-
module
|
24
|
+
module Macros # TODO: explicit test.
|
25
25
|
# Macro to quickly modify an array of functions via Pipeline::Insert and return a
|
26
26
|
# Pipeline instance.
|
27
27
|
def insert(functions, new_function, options)
|
28
|
-
Pipeline.new(Insert.(functions, new_function, options))
|
29
|
-
|
28
|
+
Pipeline.new(Pipeline::Insert.(functions, new_function, options))
|
30
29
|
end
|
31
30
|
end
|
32
|
-
extend
|
31
|
+
extend Macros
|
33
32
|
end # Pipeline
|
34
33
|
|
35
34
|
|
data/representable.gemspec
CHANGED
@@ -3,31 +3,33 @@ $:.unshift lib unless $:.include?(lib)
|
|
3
3
|
|
4
4
|
require 'representable/version'
|
5
5
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "representable"
|
8
|
+
spec.version = Representable::VERSION
|
9
|
+
spec.platform = Gem::Platform::RUBY
|
10
|
+
spec.authors = ["Nick Sutterer"]
|
11
|
+
spec.email = ["apotonick@gmail.com"]
|
12
|
+
spec.homepage = "https://github.com/apotonick/representable/"
|
13
|
+
spec.summary = %q{Renders and parses JSON/XML/YAML documents from and to Ruby objects. Includes plain properties, collections, nesting, coercion and more.}
|
14
|
+
spec.description = spec.summary
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
spec.files = `git ls-files`.split("\n")
|
17
|
+
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
spec.license = "MIT"
|
21
21
|
|
22
|
-
|
23
|
-
s.add_dependency "declarative", "~> 0.0.5"
|
22
|
+
spec.required_ruby_version = '>= 1.9.3'
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
s.add_development_dependency "minitest"
|
28
|
-
s.add_development_dependency "mongoid"
|
29
|
-
s.add_development_dependency "virtus"
|
30
|
-
s.add_development_dependency "json", '>= 1.7.7'
|
24
|
+
spec.add_dependency "uber", "~> 0.0.15"
|
25
|
+
spec.add_dependency "declarative", "~> 0.0.5"
|
31
26
|
|
32
|
-
|
27
|
+
spec.add_development_dependency "rake"
|
28
|
+
spec.add_development_dependency "test_xml", "0.1.6"
|
29
|
+
spec.add_development_dependency "minitest"
|
30
|
+
spec.add_development_dependency "mongoid"
|
31
|
+
spec.add_development_dependency "virtus"
|
32
|
+
spec.add_development_dependency "json", '>= 1.7.7'
|
33
|
+
|
34
|
+
spec.add_development_dependency "ruby-prof"
|
33
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: representable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.0.
|
4
|
+
version: 2.4.0.rc5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uber
|
@@ -320,7 +320,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
320
320
|
requirements:
|
321
321
|
- - ">="
|
322
322
|
- !ruby/object:Gem::Version
|
323
|
-
version:
|
323
|
+
version: 1.9.3
|
324
324
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
325
325
|
requirements:
|
326
326
|
- - ">"
|