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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f32866bfaa46d951c32b91d92188bc0bf59b12ea
4
- data.tar.gz: 27bcd0cff098480e72fd8111318bb4848131ce72
3
+ metadata.gz: ee5850c58fca03056e84cb446f8b9a30bb8f1a41
4
+ data.tar.gz: fae24abff445bb0366ed0db87e39ba2684192e52
5
5
  SHA512:
6
- metadata.gz: f84883c634e3d01eae501d0155a5ce12886a8ff2dfb63fd8dc6a784e9f93a08861d10ca01bec9da88e4414eb8fcaf5b16b97cb15dceba2f1c37407df2135d21e
7
- data.tar.gz: 5823c60c68513d2a3dd17402b4042c8008183dd7a0ff6ffb04ecb6ccea87bf2ab4ec88375d377393cdcff70dc82a28be10555083976d6a88fc7945efacace734
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 = 'de'
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) || :div), address, params.merge(itemscope: nil, itemtype: 'http://schema.org/PostalAddress'))
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)
@@ -1,3 +1,3 @@
1
1
  class PostalAddress
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -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 "<div 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></div>"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postal_address
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Melchert