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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37e722a1246b50c21ee87fe22a3a712bc03c3ea0
4
- data.tar.gz: 4c7cdfbdeb505aaff4f6295ef2b3c717cf4667e4
3
+ metadata.gz: 2344bb3bc4adbb5cbd3f0f920e70caac2159b017
4
+ data.tar.gz: 4a3fce1275ac3b335f1a8c211c20d4096d067a40
5
5
  SHA512:
6
- metadata.gz: c64248b241a38e218d0078116f3fbd3ba79591ca6d9cbed24c80eaa0903c0b017aa5cd18dd1a7bc70f76ee26bf7a2b29b2b6b4c764579762be6a10181555f99a
7
- data.tar.gz: a3a01d1dcd3ca21b5a2796eb4ad49f708b4d21d9710c160e176465710c45544b2894512322420e295c4dd6a70c8321d9d71814f8a8d448b977912fc99f17c895
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
- def self.build(definition)
10
- return definition.create_binding if definition[:binding]
11
- build_for(definition)
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
@@ -1,5 +1,5 @@
1
1
  module Representable
2
- Pipeline.class_eval do # FIXME: this doesn't define Function in 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
- Pipeline::Insert = Function::Insert.new
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 Insert # TODO: explicit test.
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 Insert
31
+ extend Macros
33
32
  end # Pipeline
34
33
 
35
34
 
@@ -1,3 +1,3 @@
1
1
  module Representable
2
- VERSION = "2.4.0.rc4"
2
+ VERSION = "2.4.0.rc5"
3
3
  end
@@ -3,31 +3,33 @@ $:.unshift lib unless $:.include?(lib)
3
3
 
4
4
  require 'representable/version'
5
5
 
6
- Gem::Specification.new do |s|
7
- s.name = "representable"
8
- s.version = Representable::VERSION
9
- s.platform = Gem::Platform::RUBY
10
- s.authors = ["Nick Sutterer"]
11
- s.email = ["apotonick@gmail.com"]
12
- s.homepage = "https://github.com/apotonick/representable/"
13
- s.summary = %q{Renders and parses JSON/XML/YAML documents from and to Ruby objects. Includes plain properties, collections, nesting, coercion and more.}
14
- s.description = s.summary
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
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
20
- s.license = "MIT"
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
- s.add_dependency "uber", "~> 0.0.15"
23
- s.add_dependency "declarative", "~> 0.0.5"
22
+ spec.required_ruby_version = '>= 1.9.3'
24
23
 
25
- s.add_development_dependency "rake"
26
- s.add_development_dependency "test_xml", "0.1.6"
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
- s.add_development_dependency "ruby-prof"
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.rc4
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-23 00:00:00.000000000 Z
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: '0'
323
+ version: 1.9.3
324
324
  required_rubygems_version: !ruby/object:Gem::Requirement
325
325
  requirements:
326
326
  - - ">"