diffrent 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
File without changes
data/Rakefile CHANGED
@@ -18,12 +18,12 @@ Jeweler::Tasks.new do |gem|
18
18
  gem.homepage = "http://github.com/futurechimp/diffrent"
19
19
  gem.license = "MIT"
20
20
  gem.summary = %Q{Simple ActiveRecord version diffing}
21
- gem.description = %Q{Diffrent is a very simple way to do ActiveRecord version diffing. It provides
22
- a convenient interface to two other libraries
23
- ([Diffy](https://github.com/samg/diffy) and [Vestal Versions](https://github.com/laserlemon/vestal_versions)), combining their functionality.
21
+ gem.description = %Q{Diffrent is a very simple way to do ActiveRecord version
22
+ diffing. It provides a convenient interface to two other libraries
23
+ (Diffy and Vestal Versions), combining their functionality.
24
24
 
25
- It makes no assumption about what web framework you're using - it can be used in
26
- Sinatra, Padrino, Rails, or with no framework at all. }
25
+ It makes no assumption about what web framework you're using - it can be
26
+ used in Sinatra, Padrino, Rails, or with no framework at all. }
27
27
  gem.email = "dave.hrycyszyn@headlondon.com"
28
28
  gem.authors = ["Dave Hrycyszyn"]
29
29
  # dependencies defined in Gemfile
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
data/diffrent.gemspec CHANGED
@@ -5,23 +5,23 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "diffrent"
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dave Hrycyszyn"]
12
12
  s.date = "2012-04-18"
13
- s.description = "Diffrent is a very simple way to do ActiveRecord version diffing. It provides\na convenient interface to two other libraries \n([Diffy](https://github.com/samg/diffy) and [Vestal Versions](https://github.com/laserlemon/vestal_versions)), combining their functionality. \n\nIt makes no assumption about what web framework you're using - it can be used in\nSinatra, Padrino, Rails, or with no framework at all. "
13
+ s.description = "Diffrent is a very simple way to do ActiveRecord version \n diffing. It provides a convenient interface to two other libraries \n (Diffy and Vestal Versions), combining their functionality. \n\n It makes no assumption about what web framework you're using - it can be \n used in Sinatra, Padrino, Rails, or with no framework at all. "
14
14
  s.email = "dave.hrycyszyn@headlondon.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.md"
17
+ "README"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
21
  "Gemfile",
22
22
  "Gemfile.lock",
23
23
  "LICENSE.txt",
24
- "README.md",
24
+ "README",
25
25
  "Rakefile",
26
26
  "VERSION",
27
27
  "diffrent.gemspec",
data/lib/diffrent.rb CHANGED
@@ -1,5 +1,12 @@
1
1
  module Diffrent
2
2
 
3
+ # Get a diff between two arbitrary versions of an ActiveRecord object.
4
+ #
5
+ # @param [Symbol] attr the attribute you want to diff.
6
+ # @param [Integer] old_version the version you want to start your diff at.
7
+ # @param [Integer] new_version the version you want to diff to.
8
+ # @param [Hash] options an options hash allowing you to pass a :format.
9
+ # @return [String] a diff string. If :format was nil, this could be a [Diffy::Diff].
3
10
  def diff_for(attr, old_version, new_version, options={:format => :html})
4
11
  changes = self.changes_between(new_version, old_version)
5
12
  if changes.key?(attr)
@@ -9,10 +16,16 @@ module Diffrent
9
16
  end
10
17
  end
11
18
 
19
+ # Are there previous versions?
20
+ # @param [Integer] v the version number to check.
21
+ # @return [Boolean] whether there are any versions before version v.
12
22
  def has_versions_before?(v)
13
23
  self.versions.at(v - 1)
14
24
  end
15
25
 
26
+ # Are there later versions?
27
+ # @param [Integer] v the version number to check.
28
+ # @return [Boolean] whether there are any versions after version v.
16
29
  def has_versions_after?(v)
17
30
  self.versions.at(v + 1)
18
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diffrent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-04-18 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diffy
16
- requirement: &2154626640 !ruby/object:Gem::Requirement
16
+ requirement: &2166305620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2154626640
24
+ version_requirements: *2166305620
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: vestal_versions
27
- requirement: &2154626020 !ruby/object:Gem::Requirement
27
+ requirement: &2166305140 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2154626020
35
+ version_requirements: *2166305140
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: minitest
38
- requirement: &2154625540 !ruby/object:Gem::Requirement
38
+ requirement: &2166304660 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2154625540
46
+ version_requirements: *2166304660
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &2154625060 !ruby/object:Gem::Requirement
49
+ requirement: &2166304180 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2154625060
57
+ version_requirements: *2166304180
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &2154624540 !ruby/object:Gem::Requirement
60
+ requirement: &2166303680 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.6.4
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2154624540
68
+ version_requirements: *2166303680
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
- requirement: &2154624060 !ruby/object:Gem::Requirement
71
+ requirement: &2166303140 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,24 +76,24 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2154624060
80
- description: ! "Diffrent is a very simple way to do ActiveRecord version diffing.
81
- It provides\na convenient interface to two other libraries \n([Diffy](https://github.com/samg/diffy)
82
- and [Vestal Versions](https://github.com/laserlemon/vestal_versions)), combining
83
- their functionality. \n\nIt makes no assumption about what web framework you're
84
- using - it can be used in\nSinatra, Padrino, Rails, or with no framework at all. "
79
+ version_requirements: *2166303140
80
+ description: ! "Diffrent is a very simple way to do ActiveRecord version \n diffing.
81
+ It provides a convenient interface to two other libraries \n (Diffy and Vestal
82
+ Versions), combining their functionality. \n\n It makes no assumption about
83
+ what web framework you're using - it can be \n used in Sinatra, Padrino, Rails,
84
+ or with no framework at all. "
85
85
  email: dave.hrycyszyn@headlondon.com
86
86
  executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files:
89
89
  - LICENSE.txt
90
- - README.md
90
+ - README
91
91
  files:
92
92
  - .document
93
93
  - Gemfile
94
94
  - Gemfile.lock
95
95
  - LICENSE.txt
96
- - README.md
96
+ - README
97
97
  - Rakefile
98
98
  - VERSION
99
99
  - diffrent.gemspec
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  segments:
117
117
  - 0
118
- hash: -113918672125213671
118
+ hash: 999413283423555485
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  none: false
121
121
  requirements: