addresslogic_rails 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +8 -0
- data/{README.rdoc → README.markdown} +16 -8
- data/addresslogic_rails.gemspec +3 -0
- data/lib/addresslogic_rails.rb +8 -12
- data/lib/addresslogic_rails/version.rb +1 -1
- metadata +71 -44
data/.travis.yml
ADDED
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
[![Build Status](https://secure.travis-ci.org/msimkins/addresslogic_rails.png)](http://travis-ci.org/msimkins/addresslogic_rails)
|
2
|
+
|
3
|
+
# Address Logic #
|
2
4
|
|
3
5
|
This is a simple library that takes away the annoyances of displaying addresses in a view. Since various parts of an address can sometimes be optional, such as "street2", displaying addresses was not fun:
|
4
6
|
|
5
|
-
|
7
|
+
## Example ERB use ##
|
6
8
|
|
7
9
|
<%= address.street1 %>
|
8
10
|
<br />
|
@@ -18,7 +20,7 @@ That's just ugly. Instead, you can do this with Address Logic:
|
|
18
20
|
|
19
21
|
<%= address.address_parts.join("<br />") %>
|
20
22
|
|
21
|
-
|
23
|
+
## Example HAML use ##
|
22
24
|
|
23
25
|
# some HAML view
|
24
26
|
= address.street1
|
@@ -44,9 +46,14 @@ Maybe you only want city and state:
|
|
44
46
|
|
45
47
|
Granted the above is probably easier without using AddressLogic, but it will purge any blank items in the address, so if city or state are optional then it would be cleaner to use AddressLogic.
|
46
48
|
|
47
|
-
|
49
|
+
## Build Notes ##
|
50
|
+
|
51
|
+
This should compile and build on Ruby 1.8.7/ree, MRI 1.9.x, JRuby and Rubunius, but is only officially supported under MRI 1.9.3
|
52
|
+
|
48
53
|
|
49
|
-
Install
|
54
|
+
## Install and use ##
|
55
|
+
|
56
|
+
Install from rubygems
|
50
57
|
|
51
58
|
$ sudo gem install addresslogic_rails
|
52
59
|
|
@@ -63,11 +70,12 @@ You can specify the fields too:
|
|
63
70
|
apply_addresslogic :fields => [:street1, :street2, :city, [:state, :zip], :country]
|
64
71
|
end
|
65
72
|
|
66
|
-
|
73
|
+
## Helpful links ##
|
74
|
+
|
75
|
+
* <b>Better Documentation:</b> (Coming soon)
|
67
76
|
|
68
|
-
* <b>Documentation:</b> (Coming soon)
|
69
77
|
|
78
|
+
## Authors / Copyright ##
|
70
79
|
|
71
|
-
== Authors / Copyright
|
72
80
|
* Copyright (c) 2009 Ben Johnson of [Binary Logic](http://www.binarylogic.com), released under the MIT license
|
73
81
|
* This release (c) 2011 Mike Simkins of [G7OBS Software](http://software.g7obs.com), released under the MIT license
|
data/addresslogic_rails.gemspec
CHANGED
@@ -18,4 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
|
+
s.add_development_dependency 'rake', '>= 0.9.2'
|
22
|
+
s.add_development_dependency 'yard', '~> 0.7'
|
23
|
+
s.add_runtime_dependency 'rails', '>= 3.2.0'
|
21
24
|
end
|
data/lib/addresslogic_rails.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
module AddresslogicRails
|
2
|
-
|
3
|
-
|
4
|
-
end
|
5
|
-
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
6
4
|
module ClassMethods
|
7
5
|
attr_accessor :addresslogic_options
|
8
|
-
|
6
|
+
|
9
7
|
# Mixes in useful methods for handling addresses.
|
10
8
|
#
|
11
9
|
# === Options
|
@@ -21,12 +19,11 @@ module AddresslogicRails
|
|
21
19
|
"#{n}country".to_sym
|
22
20
|
]
|
23
21
|
self.addresslogic_options = options
|
24
|
-
|
25
|
-
include AddresslogicRails::InstanceMethods
|
22
|
+
|
26
23
|
end
|
27
24
|
end
|
28
|
-
|
29
|
-
|
25
|
+
|
26
|
+
|
30
27
|
# Returns the parts of an address in an array. Example:
|
31
28
|
#
|
32
29
|
# ["Street1", "Street2", "City", "State Zip", "Country"]
|
@@ -45,7 +42,7 @@ module AddresslogicRails
|
|
45
42
|
options[:except] = [options[:except]] if options[:except] && !options[:except].is_a?(Array)
|
46
43
|
fields = args[0] || self.class.addresslogic_options[:fields]
|
47
44
|
level = args[1] || 0
|
48
|
-
|
45
|
+
|
49
46
|
parts = []
|
50
47
|
fields.each do |field|
|
51
48
|
if field.is_a?(Array)
|
@@ -61,10 +58,9 @@ module AddresslogicRails
|
|
61
58
|
parts << value
|
62
59
|
end
|
63
60
|
end
|
64
|
-
|
61
|
+
|
65
62
|
parts
|
66
63
|
end
|
67
|
-
end
|
68
64
|
end
|
69
65
|
|
70
66
|
Object.send(:include, AddresslogicRails)
|
metadata
CHANGED
@@ -1,75 +1,102 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: addresslogic_rails
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 0.0.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Mike Simkins
|
14
9
|
- Ben Johnson
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
date: 2012-07-18 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rake
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.9.2
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 0.9.2
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: yard
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0.7'
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.7'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rails
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.2.0
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 3.2.0
|
23
63
|
description: This is a gem port of binary logics 'addresslogic' to Rails 3 and a Gem
|
24
|
-
email:
|
64
|
+
email:
|
25
65
|
- software@g7obs.com
|
26
66
|
executables: []
|
27
|
-
|
28
67
|
extensions: []
|
29
|
-
|
30
68
|
extra_rdoc_files: []
|
31
|
-
|
32
|
-
files:
|
69
|
+
files:
|
33
70
|
- .gitignore
|
71
|
+
- .travis.yml
|
34
72
|
- Gemfile
|
35
|
-
- README.
|
73
|
+
- README.markdown
|
36
74
|
- Rakefile
|
37
75
|
- addresslogic_rails.gemspec
|
38
76
|
- lib/addresslogic_rails.rb
|
39
77
|
- lib/addresslogic_rails/version.rb
|
40
|
-
|
41
|
-
homepage: ""
|
78
|
+
homepage: ''
|
42
79
|
licenses: []
|
43
|
-
|
44
80
|
post_install_message:
|
45
81
|
rdoc_options: []
|
46
|
-
|
47
|
-
require_paths:
|
82
|
+
require_paths:
|
48
83
|
- lib
|
49
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
85
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
-
|
56
|
-
- 0
|
57
|
-
version: "0"
|
58
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
91
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
segments:
|
65
|
-
- 0
|
66
|
-
version: "0"
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
67
96
|
requirements: []
|
68
|
-
|
69
97
|
rubyforge_project: addresslogicr3
|
70
|
-
rubygems_version: 1.
|
98
|
+
rubygems_version: 1.8.24
|
71
99
|
signing_key:
|
72
100
|
specification_version: 3
|
73
101
|
summary: AddressLogic for Rails 3
|
74
102
|
test_files: []
|
75
|
-
|