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 +4 -4
- data/CHANGES.md +4 -0
- data/lib/disposable/twin.rb +8 -1
- data/lib/disposable/version.rb +1 -1
- data/test/twin/composition_test.rb +2 -2
- data/test/twin/twin_test.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 345b091b0b6fb0e6556ab3842a87693dc63398ff
|
4
|
+
data.tar.gz: f4e6802493f81d2644c61a8bbd676c66e06d1e04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c80d3106575273ed11dc1334aea93ea1368f4eeb0dc7f47a41cd9143961881e224fb0f40ecaec25ac57dd70e39d4a667e88c1b512f55931b0ba381e14a4241e4
|
7
|
+
data.tar.gz: 499727d06fe0883a74a66ee752412813be28bb33207692c3a55a564b06f5745f6f27e6620d5436b148fb6075d01b0d3a667747bad251a25b8953222f706c2c27
|
data/CHANGES.md
CHANGED
data/lib/disposable/twin.rb
CHANGED
@@ -18,7 +18,8 @@ module Disposable
|
|
18
18
|
|
19
19
|
|
20
20
|
def self.property(name, options={}, &block)
|
21
|
-
options
|
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
|
data/lib/disposable/version.rb
CHANGED
@@ -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, :
|
8
|
-
property :song_id, :on => :song, :
|
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
|
data/test/twin/twin_test.rb
CHANGED
@@ -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, :
|
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
|
-
# :
|
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, :
|
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, :
|
129
|
-
property :record, :twin => 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.
|
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-
|
11
|
+
date: 2014-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uber
|