has_versions 0.7.2 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: effd5d98f517c4fdfef9d8821fed62243e754199
4
- data.tar.gz: fed8a067720dc4246328a5bf041fbc425e27b136
3
+ metadata.gz: 5c8b422b5420880774f2c762226fe857089fa499
4
+ data.tar.gz: 879836886df8c06af5f1faa92718f3a22da8eaa3
5
5
  SHA512:
6
- metadata.gz: 9de3d5d6022c1b7f3f42eefbaa9bdf7ec7aaa700fcef5446a504c94fa92170d55d945db7e9f115df4510a89938de18e4a79ca53dacad67dab848e669c47735d0
7
- data.tar.gz: 1e822d3727d15eebb9141de7964a3c632a24da4eb78b8e60ea76321f90fcae95e9b91d3a7831d5fbf6279b26280f02e3318935e21411f239b425666a75fefdcf
6
+ metadata.gz: ec00d321511442b133f24249c4a1b303cb8ce1a70c2c3e27cc221c9e4e887b6e855cb9b16977f248b07c3b876ef70cab966987db81f80e734d9512c000d3328a
7
+ data.tar.gz: 1388cfa1208f095bc8dc2684005c9323c785c28a37fca1c336811cf22a0b987a2f28022e78b3dc1b0dd2f0e5abd00c8ecfa254a79235b0b3002b67776c887b9c
data/has_versions.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = "has_versions"
4
- s.version = '0.7.2'
4
+ s.version = '0.8.0'
5
5
 
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["Grant Rodgers"]
@@ -35,7 +35,6 @@ module HasVersions
35
35
  def to_version
36
36
  self.class.version_model.new(
37
37
  snapshot: versioned_attributes,
38
- associated_versions: associated_versions,
39
38
  target: self
40
39
  )
41
40
  end
@@ -21,14 +21,6 @@ module HasVersions
21
21
  end
22
22
  end
23
23
 
24
- def associated_versions
25
- if versioning_configuration.associated_versions_callback
26
- instance_eval(&versioning_configuration.associated_versions_callback).compact
27
- else
28
- nil
29
- end
30
- end
31
-
32
24
  private
33
25
  def create_versioned_attributes(&block)
34
26
  self.class.versioned_attributes.inject({}) do |memo, attribute|
@@ -2,7 +2,6 @@ module HasVersions
2
2
  module Record
3
3
  class Configuration
4
4
  attr_accessor :attributes
5
- attr_accessor :associated_versions_callback
6
5
 
7
6
  def initialize
8
7
  self.attributes = []
@@ -11,10 +10,6 @@ module HasVersions
11
10
  def attribute(name)
12
11
  attributes << name.to_s
13
12
  end
14
-
15
- def associated_versions(&block)
16
- self.associated_versions_callback = block
17
- end
18
13
  end
19
14
  end
20
15
  end
@@ -24,27 +24,6 @@ module HasVersions
24
24
 
25
25
  assert_equal expected, record.versioned_attributes
26
26
  end
27
-
28
- # def test_instance_versioned_attributes_was
29
- # record = VersionedRecord.new(name: 'joe', price: nil, weight: 142.0, color: 'green')
30
- # expected = {'name' => 'joe', 'weight' => '142.0'}
31
- #
32
- # assert_equal expected, record.versioned_attributes_was
33
- # end
34
-
35
- def test_associated_versions_when_defined
36
- model = Class.new(VersionedRecord) do
37
- versioning_configuration.associated_versions do
38
- ["#{name} Hendrix", nil]
39
- end
40
- end
41
-
42
- assert_equal ["Jimi Hendrix"], model.new(name: "Jimi").associated_versions
43
- end
44
-
45
- def test_associated_versions_when_not_defined
46
- assert_nil VersionedRecord.new.associated_versions
47
- end
48
27
  end
49
28
  end
50
29
  end
@@ -10,15 +10,6 @@ module HasVersions
10
10
 
11
11
  assert_equal %w(foo bar), configuration.attributes
12
12
  end
13
-
14
- def test_associated_versions
15
- configuration = HasVersions::Record::Configuration.new
16
- configuration.associated_versions do
17
- "poop"
18
- end
19
-
20
- assert_equal "poop", configuration.associated_versions_callback.call
21
- end
22
13
  end
23
14
  end
24
15
  end
@@ -15,16 +15,12 @@ module HasVersions
15
15
  record = Class.new(TestRecord) do
16
16
  attr_accessor :name
17
17
  versioning_configuration.attribute :name
18
- versioning_configuration.associated_versions do
19
- ["hola"]
20
- end
21
18
  end.new(name: 'wee')
22
19
 
23
20
  version = record.to_version
24
21
 
25
22
  assert_kind_of TestVersion, version
26
23
  assert_equal record, version.target
27
- assert_equal ["hola"], version.associated_versions
28
24
  assert_equal record.versioned_attributes, version.snapshot
29
25
  end
30
26
  end
@@ -4,7 +4,6 @@ class TestVersion
4
4
  attr_reader :snapshot
5
5
  attr_accessor :parent
6
6
  attr_accessor :target
7
- attr_accessor :associated_versions
8
7
 
9
8
  def initialize(attributes = {})
10
9
  attributes.each do |key, value|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_versions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Rodgers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-11 00:00:00.000000000 Z
11
+ date: 2013-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project: has_versions
98
- rubygems_version: 2.0.0
98
+ rubygems_version: 2.0.2
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: ActiveModel versioning