addresslogic 1.2.0 → 1.2.1
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/CHANGELOG.rdoc +6 -1
- data/Rakefile +1 -0
- data/VERSION.yml +1 -1
- data/addresslogic.gemspec +5 -4
- data/lib/addresslogic.rb +7 -5
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -11,6 +11,7 @@ begin
|
|
11
11
|
gem.authors = ["Ben Johnson of Binary Logic"]
|
12
12
|
gem.rubyforge_project = "addresslogic"
|
13
13
|
end
|
14
|
+
Jeweler::GemcutterTasks.new
|
14
15
|
Jeweler::RubyforgeTasks.new
|
15
16
|
rescue LoadError
|
16
17
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
data/VERSION.yml
CHANGED
data/addresslogic.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{addresslogic}
|
8
|
-
s.version = "1.2.
|
8
|
+
s.version = "1.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ben Johnson of Binary Logic"]
|
12
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-11-18}
|
13
13
|
s.email = %q{bjohnson@binarylogic.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
@@ -50,3 +50,4 @@ Gem::Specification.new do |s|
|
|
50
50
|
else
|
51
51
|
end
|
52
52
|
end
|
53
|
+
|
data/lib/addresslogic.rb
CHANGED
@@ -5,22 +5,24 @@ module Addresslogic
|
|
5
5
|
end
|
6
6
|
|
7
7
|
module ClassMethods
|
8
|
-
attr_accessor :
|
8
|
+
attr_accessor :addresslogic_options
|
9
9
|
|
10
10
|
# Mixes in useful methods for handling addresses.
|
11
11
|
#
|
12
12
|
# === Options
|
13
13
|
#
|
14
14
|
# * <tt>fields:</tt> array of fields (default: [:street1, :street2, [:city, [:state, :zip]], :country])
|
15
|
-
# * <tt>
|
15
|
+
# * <tt>namespace:</tt> prefixes fields names with this, great for use with composed_of in ActiveRecord.
|
16
16
|
def apply_addresslogic(options = {})
|
17
|
-
n = options[:
|
18
|
-
|
17
|
+
n = options[:namespace]
|
18
|
+
options[:fields] ||= [
|
19
19
|
"#{n}street1".to_sym,
|
20
20
|
"#{n}street2".to_sym,
|
21
21
|
["#{n}city".to_sym, ["#{n}state".to_sym, "#{n}zip".to_sym]],
|
22
22
|
"#{n}country".to_sym
|
23
23
|
]
|
24
|
+
self.addresslogic_options = options
|
25
|
+
|
24
26
|
include Addresslogic::InstanceMethods
|
25
27
|
end
|
26
28
|
end
|
@@ -42,7 +44,7 @@ module Addresslogic
|
|
42
44
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
43
45
|
options[:only] = [options[:only]] if options[:only] && !options[:only].is_a?(Array)
|
44
46
|
options[:except] = [options[:except]] if options[:except] && !options[:except].is_a?(Array)
|
45
|
-
fields = args[0] || self.class.
|
47
|
+
fields = args[0] || self.class.addresslogic_options[:fields]
|
46
48
|
level = args[1] || 0
|
47
49
|
|
48
50
|
parts = []
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: addresslogic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Johnson of Binary Logic
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-18 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|