postal_address 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -1
- data/lib/postal_address/instance_methods.rb +1 -1
- data/lib/postal_address/version.rb +1 -1
- data/spec/postal_address_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee5850c58fca03056e84cb446f8b9a30bb8f1a41
|
4
|
+
data.tar.gz: fae24abff445bb0366ed0db87e39ba2684192e52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffc4b57e2ebbc450bfb3f2fc5f57bdc8985c5e48359998f14e793219fc74338710644a0c0bd94bb256cb79a9556fc43b7825dc07320eff5c9f81e04b0b49d9d3
|
7
|
+
data.tar.gz: 97bb83b15043f907e685f870114c647c4aa8af31d9bbf93ad8349181b02eeaf5d3f041bf32e08370a72efc9197e8f5eb40e831ed845f40bfc5104919223ee200
|
data/README.md
CHANGED
@@ -30,10 +30,43 @@ Or install it yourself as:
|
|
30
30
|
}
|
31
31
|
|
32
32
|
PostalAddress.new(address).to_s
|
33
|
+
|
34
|
+
Tobias Füncke
|
35
|
+
101 Broadway
|
36
|
+
New York City NY 10002
|
37
|
+
United States of America
|
38
|
+
|
39
|
+
PostalAddress.new(address).to_html
|
40
|
+
|
41
|
+
<p itemscope itemtype="http://schema.org/PostalAddress">
|
42
|
+
<span itemprop="name">Tobias Füncke</span>
|
43
|
+
<br>
|
44
|
+
<span itemprop="streetAddress">101 Broadway</span>
|
45
|
+
<br>
|
46
|
+
<span itemprop="addressLocality">New York City</span>
|
47
|
+
<span itemprop="addressRegion">NY</span>
|
48
|
+
<span itemprop="postalCode">10002</span>
|
49
|
+
<br>
|
50
|
+
<span itemprop="addressCountry">United States of America</span>
|
51
|
+
</p>
|
52
|
+
|
33
53
|
|
34
54
|
Set a home country (country names are not display for those addresses)
|
35
55
|
|
36
|
-
PostalAddress.home_country = '
|
56
|
+
PostalAddress.home_country = 'us'
|
57
|
+
|
58
|
+
p = PostalAddress.new(address)
|
59
|
+
p.to_html(tag: 'section', itemprop: 'address')
|
60
|
+
|
61
|
+
<section itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
|
62
|
+
<span itemprop="name">Tobias Füncke</span>
|
63
|
+
<br>
|
64
|
+
<span itemprop="streetAddress">101 Broadway</span>
|
65
|
+
<br>
|
66
|
+
<span itemprop="addressLocality">New York City</span>
|
67
|
+
<span itemprop="addressRegion">NY</span>
|
68
|
+
<span itemprop="postalCode">10002</span>
|
69
|
+
</section>
|
37
70
|
|
38
71
|
## Contributing
|
39
72
|
|
@@ -16,7 +16,7 @@ class PostalAddress
|
|
16
16
|
|
17
17
|
def to_html(params={})
|
18
18
|
address = format(attributes(:html)).gsub("\n", "<br>")
|
19
|
-
content_tag((params.delete(:tag) || :
|
19
|
+
content_tag((params.delete(:tag) || :p), address, params.merge(itemscope: nil, itemtype: 'http://schema.org/PostalAddress'))
|
20
20
|
end
|
21
21
|
|
22
22
|
def country_code=(code)
|
data/spec/postal_address_spec.rb
CHANGED
@@ -106,7 +106,7 @@ describe PostalAddress do
|
|
106
106
|
end
|
107
107
|
|
108
108
|
it "should return html" do
|
109
|
-
address.to_html.must_equal "<
|
109
|
+
address.to_html.must_equal "<p itemscope itemtype=\"http://schema.org/PostalAddress\"><span itemprop=\"name\">Tobias Füncke</span><br><span itemprop=\"streetAddress\">101 Broadway</span><br><span itemprop=\"addressLocality\">New York City</span> <span itemprop=\"addressRegion\">NY</span> <span itemprop=\"postalCode\">10002</span><br><span itemprop=\"addressCountry\">United States of America</span></p>"
|
110
110
|
end
|
111
111
|
|
112
112
|
it "should return custom html" do
|