binarylogic-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 CHANGED
@@ -1,4 +1,9 @@
1
- == 1.1.4
1
+ == 1.2.1
2
+
3
+ * Use addresslogic_options class level accessor
4
+ * Change :composition_namespace to :namespace
5
+
6
+ == 1.2.0
2
7
 
3
8
  * Added :composition_namespace option.
4
9
 
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 2
4
- :patch: 0
4
+ :patch: 1
data/addresslogic.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{addresslogic}
8
- s.version = "1.2.0"
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-08-15}
12
+ s.date = %q{2009-08-16}
13
13
  s.email = %q{bjohnson@binarylogic.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
data/lib/addresslogic.rb CHANGED
@@ -5,22 +5,24 @@ module Addresslogic
5
5
  end
6
6
 
7
7
  module ClassMethods
8
- attr_accessor :address_parts_fields
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>composition_namespace:</tt> prefixes fields names with this, great for use with composed_of in ActiveRecord.
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[:composition_namespace]
18
- self.address_parts_fields = options[:fields] || [
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.address_parts_fields
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: binarylogic-addresslogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
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-08-15 00:00:00 -07:00
12
+ date: 2009-08-16 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15