nameable_record 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/nameable_record/active_record_extensions.rb +20 -20
- data/nameable_record.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -1,32 +1,32 @@
|
|
1
1
|
module NameableRecord
|
2
2
|
module ActiveRecordExtensions
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
def self.included( base )
|
4
|
+
base.extend ActsMethods
|
5
|
+
end
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
module ActsMethods
|
8
|
+
def has_name( *args )
|
9
|
+
unless included_modules.include? InstanceMethods
|
10
|
+
self.class_eval { extend ClassMethods }
|
11
|
+
include InstanceMethods
|
12
|
+
end
|
13
|
+
initialize_compositions( args )
|
12
14
|
end
|
13
|
-
initialize_compositions( args )
|
14
|
-
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
alias_method :has_names, :has_name
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
module ClassMethods
|
20
|
+
def initialize_compositions( attrs )
|
21
|
+
attrs.each do |attr|
|
22
|
+
composed_of attr, :class_name => "NameableRecord::Name", :mapping => [["#{attr}_last", "last"], ["#{attr}_first", "first"],
|
23
|
+
["#{attr}_prefix", "prefix"], ["#{attr}_middle", "middle"], ["#{attr}_suffix", "suffix"]]
|
24
|
+
end
|
24
25
|
end
|
25
26
|
end
|
26
|
-
end
|
27
27
|
|
28
|
-
|
28
|
+
module InstanceMethods
|
29
29
|
|
30
|
+
end
|
30
31
|
end
|
31
|
-
end
|
32
32
|
end
|
data/nameable_record.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{nameable_record}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["C. Jason Harrelson"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-02}
|
13
13
|
s.description = %q{Encapsulates the composed of pattern for names into any easy to use library.}
|
14
14
|
s.email = %q{jason@lookforwardenterprises.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nameable_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- C. Jason Harrelson
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-02 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|