disposable 0.0.8 → 0.0.9

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: fbd96277db19aa9fdf0cb9d0b46942cb2cbd2983
4
- data.tar.gz: d3cc09426627c5bcc459b80d1eb90deaf66268f8
3
+ metadata.gz: 345b091b0b6fb0e6556ab3842a87693dc63398ff
4
+ data.tar.gz: f4e6802493f81d2644c61a8bbd676c66e06d1e04
5
5
  SHA512:
6
- metadata.gz: df682d54394835e9d682f3a1e2815be97d849640f7c4b0a171dc31cd2ccb431e24e47df3dcbf019c1bc87a93638dc0239afabb0cb63f513feaf3892dafeb20af
7
- data.tar.gz: f6023c52816ca6ba2636d05b1cd49fe660d68bfd4af1cff88f45142c844e1b29b6da3732ff9dfc805aa4ae1c250d64ab840aaac287215352ecb73c393b7e70e3
6
+ metadata.gz: c80d3106575273ed11dc1334aea93ea1368f4eeb0dc7f47a41cd9143961881e224fb0f40ecaec25ac57dd70e39d4a667e88c1b512f55931b0ba381e14a4241e4
7
+ data.tar.gz: 499727d06fe0883a74a66ee752412813be28bb33207692c3a55a564b06f5745f6f27e6620d5436b148fb6075d01b0d3a667747bad251a25b8953222f706c2c27
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.0.9
2
+
3
+ * Rename `:as` to `:from`. Deprecated, this will be removed in 0.1.0.
4
+
1
5
  # 0.0.8
2
6
 
3
7
  * Introduce the `Twin::Builder` module to easily allow creating a twin in a host object's constructor.
@@ -18,7 +18,8 @@ module Disposable
18
18
 
19
19
 
20
20
  def self.property(name, options={}, &block)
21
- options[:private_name] = options.delete(:as) || name
21
+ deprecate_as!(options) # TODO: remove me in 0.1.0
22
+ options[:private_name] = options.delete(:from) || name
22
23
  options[:pass_options] = true
23
24
 
24
25
  representer_class.property(name, options, &block).tap do |definition|
@@ -72,5 +73,11 @@ module Disposable
72
73
  attr_reader :model # TODO: test
73
74
 
74
75
  include Option
76
+
77
+ def self.deprecate_as!(options) # TODO: remove me in 0.1.0
78
+ return unless as = options.delete(:as)
79
+ options[:from] = as
80
+ warn "[Disposable] The :as options got renamed to :from."
81
+ end
75
82
  end
76
83
  end
@@ -1,3 +1,3 @@
1
1
  module Disposable
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -4,8 +4,8 @@ require 'disposable/twin/composition'
4
4
 
5
5
  class TwinCompositionTest < MiniTest::Spec
6
6
  class Request < Disposable::Twin::Composition
7
- property :song_title, :on => :song, :as => :title
8
- property :song_id, :on => :song, :as => :id
7
+ property :song_title, :on => :song, :from => :title
8
+ property :song_id, :on => :song, :from => :id
9
9
 
10
10
  property :name, :on => :requester
11
11
  property :id, :on => :requester
@@ -19,7 +19,7 @@ class TwinTest < MiniTest::Spec
19
19
 
20
20
  class Song < Disposable::Twin
21
21
  property :id # DISCUSS: needed for #save.
22
- property :name, :as => :title
22
+ property :name, :from => :title
23
23
  property :album, :twin => Album
24
24
 
25
25
  # model Model::Song
@@ -32,7 +32,7 @@ class TwinTest < MiniTest::Spec
32
32
  it do
33
33
  twin = Twin::Song.new(song)
34
34
  song.id = 2
35
- # :as maps public name
35
+ # :from maps public name
36
36
  twin.name.must_equal "Broken" # public: #name
37
37
  twin.id.must_equal 2
38
38
  end
@@ -119,14 +119,14 @@ class TwinAsTest < MiniTest::Spec
119
119
 
120
120
  module Twin
121
121
  class Album < Disposable::Twin
122
- property :record_name, :as => :name
122
+ property :record_name, :from => :name
123
123
 
124
124
  # model Model::Album
125
125
  end
126
126
 
127
127
  class Song < Disposable::Twin
128
- property :name, :as => :title
129
- property :record, :twin => Album, :as => :album
128
+ property :name, :from => :title
129
+ property :record, :twin => Album, :from => :album
130
130
 
131
131
  # model Model::Song
132
132
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disposable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-30 00:00:00.000000000 Z
11
+ date: 2014-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uber