minimapper 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -181,6 +181,9 @@ If you specify type, minimapper will attempt to convert into that type. Supporte
181
181
  class User
182
182
  include Minimapper::Entity
183
183
  attributes [ :profile_id, :integer ]
184
+
185
+ # Or for single attributes:
186
+ # attribute :profile_id, :integer
184
187
  end
185
188
 
186
189
  User.new(:profile_id => "10").profile_id # => 10
@@ -11,6 +11,10 @@ module Minimapper
11
11
  end
12
12
  end
13
13
 
14
+ def attribute(*opts)
15
+ attributes [ *opts ]
16
+ end
17
+
14
18
  def column_names
15
19
  @entity_columns.map(&:name).map(&:to_s)
16
20
  end
@@ -1,3 +1,3 @@
1
1
  module Minimapper
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
data/unit/entity_spec.rb CHANGED
@@ -14,6 +14,12 @@ class TestProject
14
14
  attributes :title
15
15
  end
16
16
 
17
+ class TestTask
18
+ include Minimapper::Entity
19
+
20
+ attribute :due_at, :date_time
21
+ end
22
+
17
23
  describe Minimapper::Entity do
18
24
  it "handles base attributes" do
19
25
  entity = TestEntity.new
@@ -50,6 +56,11 @@ describe Minimapper::Entity do
50
56
  entity.id.should == 15
51
57
  end
52
58
 
59
+ it "can use single line type declarations" do
60
+ task = TestTask.new(:due_at => "2012-01-01 15:00")
61
+ task.due_at.should == DateTime.parse("2012-01-01 15:00")
62
+ end
63
+
53
64
  it "sets blank values to nil" do
54
65
  user = TestUser.new
55
66
  user.name = " "
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-19 00:00:00.000000000 Z
12
+ date: 2012-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70245281835840 !ruby/object:Gem::Requirement
16
+ requirement: &70303088200960 !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: *70245281835840
24
+ version_requirements: *70303088200960
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: -1233947130064928400
80
+ hash: -3678706732154060402
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: -1233947130064928400
89
+ hash: -3678706732154060402
90
90
  requirements: []
91
91
  rubyforge_project:
92
92
  rubygems_version: 1.8.5