minimapper 0.2.7 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -154,7 +154,7 @@ end
154
154
  module AR
155
155
  class ProjectMapper < Minimapper::AR
156
156
  def waiting_for_review
157
- record_klass.where(waiting_for_review: true).order("id DESC").map do |record|
157
+ record_class.where(waiting_for_review: true).order("id DESC").map do |record|
158
158
  entity_for(record)
159
159
  end
160
160
  end
data/lib/minimapper/ar.rb CHANGED
@@ -7,7 +7,7 @@ module Minimapper
7
7
  # Create
8
8
  def create(entity)
9
9
  if entity.valid?
10
- entity.id = record_klass.create!(accessible_attributes(entity)).id
10
+ entity.id = record_class.create!(accessible_attributes(entity)).id
11
11
  else
12
12
  false
13
13
  end
@@ -23,19 +23,19 @@ module Minimapper
23
23
  end
24
24
 
25
25
  def all
26
- entities_for record_klass.all
26
+ entities_for record_class.all
27
27
  end
28
28
 
29
29
  def first
30
- entity_for(record_klass.order("id ASC").first)
30
+ entity_for(record_class.order("id ASC").first)
31
31
  end
32
32
 
33
33
  def last
34
- entity_for(record_klass.order("id ASC").last)
34
+ entity_for(record_class.order("id ASC").last)
35
35
  end
36
36
 
37
37
  def count
38
- record_klass.count
38
+ record_class.count
39
39
  end
40
40
 
41
41
  # Update
@@ -59,7 +59,7 @@ module Minimapper
59
59
  end
60
60
 
61
61
  def delete_all
62
- record_klass.delete_all
62
+ record_class.delete_all
63
63
  end
64
64
 
65
65
  private
@@ -68,7 +68,7 @@ module Minimapper
68
68
 
69
69
  # Will attempt to use AR:Project as the record class
70
70
  # when the mapper class name is AR::ProjectMapper
71
- def record_klass
71
+ def record_class
72
72
  self.class.name.gsub(/Mapper/, '').constantize
73
73
  end
74
74
 
@@ -83,7 +83,7 @@ module Minimapper
83
83
  end
84
84
 
85
85
  def protected_attributes
86
- record_klass.protected_attributes
86
+ record_class.protected_attributes
87
87
  end
88
88
 
89
89
  def find_record_safely(id)
@@ -92,11 +92,11 @@ module Minimapper
92
92
  end
93
93
 
94
94
  def find_record(id)
95
- id && record_klass.find_by_id(id)
95
+ id && record_class.find_by_id(id)
96
96
  end
97
97
 
98
98
  def record_for(entity)
99
- (entity.id && record_klass.find_by_id(entity.id)) ||
99
+ (entity.id && record_class.find_by_id(entity.id)) ||
100
100
  raise(Common::CanNotFindEntity, entity.inspect)
101
101
  end
102
102
 
@@ -1,3 +1,3 @@
1
1
  module Minimapper
2
- VERSION = "0.2.7"
2
+ VERSION = "0.3.0"
3
3
  end
data/minimapper.gemspec CHANGED
@@ -6,7 +6,7 @@ require 'minimapper/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "minimapper"
8
8
  gem.version = Minimapper::VERSION
9
- gem.authors = ["Joakim Kolsjö"]
9
+ gem.authors = ["Joakim Kolsjo"]
10
10
  gem.email = ["joakim.kolsjo@gmail.com"]
11
11
  gem.description = %q{A minimalistic way of separating your models from ORMs like ActiveRecord.}
12
12
  gem.summary = %q{A minimalistic way of separating your models from ORMs like ActiveRecord.}
data/spec/ar_spec.rb CHANGED
@@ -13,7 +13,7 @@ class TestMapper < Minimapper::AR
13
13
  TestEntity
14
14
  end
15
15
 
16
- def record_klass
16
+ def record_class
17
17
  Record
18
18
  end
19
19
 
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - Joakim Kolsjö
8
+ - Joakim Kolsjo
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-06 00:00:00.000000000 Z
12
+ date: 2013-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70347484679120 !ruby/object:Gem::Requirement
16
+ requirement: &70114985880520 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70347484679120
24
+ version_requirements: *70114985880520
25
25
  description: A minimalistic way of separating your models from ORMs like ActiveRecord.
26
26
  email:
27
27
  - joakim.kolsjo@gmail.com
@@ -77,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  segments:
79
79
  - 0
80
- hash: -3403860792313798379
80
+ hash: 1267216802408816283
81
81
  required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  none: false
83
83
  requirements:
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  segments:
88
88
  - 0
89
- hash: -3403860792313798379
89
+ hash: 1267216802408816283
90
90
  requirements: []
91
91
  rubyforge_project:
92
92
  rubygems_version: 1.8.5