attribute_mapper 0.9.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -0
- data/Rakefile +1 -1
- data/VERSION.yml +4 -3
- data/init.rb +1 -2
- data/lib/attribute_mapper.rb +3 -11
- data/test/attribute_mapper_test.rb +4 -5
- metadata +2 -2
data/README.md
CHANGED
data/Rakefile
CHANGED
data/VERSION.yml
CHANGED
data/init.rb
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
require File.dirname(__FILE__)
|
2
|
-
AttributeMapper.load
|
1
|
+
require File.join(File.dirname(__FILE__), "/lib/attribute_mapper")
|
data/lib/attribute_mapper.rb
CHANGED
@@ -1,16 +1,8 @@
|
|
1
1
|
module AttributeMapper
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
model.extend ClassMethods
|
7
|
-
model.send(:include, InstanceMethods)
|
8
|
-
end
|
9
|
-
|
10
|
-
def load
|
11
|
-
ActiveRecord::Base.send(:include, AttributeMapper)
|
12
|
-
end
|
13
|
-
|
3
|
+
def self.included(model)
|
4
|
+
model.extend ClassMethods
|
5
|
+
model.send(:include, InstanceMethods)
|
14
6
|
end
|
15
7
|
|
16
8
|
module ClassMethods
|
@@ -1,11 +1,9 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
require 'shoulda'
|
3
|
-
require 'active_record'
|
4
3
|
|
4
|
+
require 'active_record'
|
5
5
|
require 'attribute_mapper'
|
6
6
|
|
7
|
-
AttributeMapper.load
|
8
|
-
|
9
7
|
ActiveRecord::Base.establish_connection(
|
10
8
|
:adapter => 'sqlite3',
|
11
9
|
:database => ':memory:'
|
@@ -19,6 +17,7 @@ end
|
|
19
17
|
|
20
18
|
# Pseudo model for testing purposes
|
21
19
|
class Ticket < ActiveRecord::Base
|
20
|
+
include AttributeMapper
|
22
21
|
end
|
23
22
|
|
24
23
|
class AttributeMapperTest < Test::Unit::TestCase
|
@@ -90,11 +89,11 @@ class AttributeMapperTest < Test::Unit::TestCase
|
|
90
89
|
#######
|
91
90
|
private
|
92
91
|
#######
|
93
|
-
|
92
|
+
|
94
93
|
def mapping(options = {})
|
95
94
|
{:open => 1, :closed => 2}.merge(options)
|
96
95
|
end
|
97
|
-
|
96
|
+
|
98
97
|
def ticket
|
99
98
|
@ticket ||= Ticket.new
|
100
99
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attribute_mapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcel Molina Jr.
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-
|
14
|
+
date: 2009-12-22 00:00:00 -06:00
|
15
15
|
default_executable:
|
16
16
|
dependencies: []
|
17
17
|
|