README.md in biggs-0.3.3 vs README.md in biggs-0.4.0
- old
+ new
@@ -2,58 +2,58 @@
### Install
As a ruby gem:
- sudo gem install biggs
+ gem install biggs
-If your rather prefer to install it as a plugin for rails, from your application directory simply run:
-
- script/plugin install git://github.com/yolk/biggs.git
-
### Standalone usage
f = Biggs::Formatter.new
f.format("de", # <= ISO alpha 2 code
:recipient => "Yolk Sebastian Munz & Julia Soergel GbR",
- :street => "Adalbertstr. 11", # <= street + house number
- :city => "Berlin",
- :zip => 10999,
- :state => "Berlin" # <= state/province/region
+ :street => "Musterallee 12", # <= street + house number
+ :city => "Ausgedacht",
+ :zip => 12345,
+ :state => "Nowhere" # <= state/province/region
)
returns
"Yolk Sebastian Munz & Julia Soergel GbR
- Adalbertstr. 11
- 10999 Berlin
+ Musterallee 12
+ 12345 Ausgedacht
Germany"
At the moment Biggs::Formatter.new accepts only one option:
-*blank_county_on* ISO alpha 2 code (single string or array) of countries the formatter should skip the line "country" (for national shipping).
+*blank_country_on* ISO alpha 2 code (single string or array) of countries the formatter should skip the line "country" (for national shipping).
- Biggs::Formatter.new(:blank_county_on => "de")
+ Biggs::Formatter.new(blank_country_on: "de")
With the data from the above example this would return:
"Yolk Sebastian Munz & Julia Soergel GbR
- Adalbertstr. 11
- 10999 Berlin"
+ Musterallee 12
+ 12345 Ausgedacht"
### Usage with Rails and ActiveRecord
Address < ActiveRecord::Base
+ include Biggs::ActiveRecordAdapter
+
biggs :postal_address
end
This adds the method postal_address to your Address-model, and assumes the presence of the methods/columns recipient, street, city, zip, state, and country to get the address data. Country should return the ISO-code (e.g. 'us', 'fr', 'de').
You can customize the method-names biggs will use by passing in a hash of options:
Address < ActiveRecord::Base
+ include Biggs::ActiveRecordAdapter
+
biggs :postal_address,
:zip => :postal_code,
:country => :country_code,
:street => Proc.new {|address| "#{address.street} #{address.house_number}" }
end
@@ -61,10 +61,12 @@
You can pass in a symbol to let biggs call a different method on your Address-model, or a Proc-object to create your data on the fly.
You can even pass in a array of symbols:
Address < ActiveRecord::Base
+ include Biggs::ActiveRecordAdapter
+
biggs :postal_address,
:recipient => [:company_name, :person_name]
end
This will call the methods company_name and person_name on your address-instance, remove any blank returned values and join the rest by a line break.
@@ -143,8 +145,8 @@
* United Arab Emirates
* United Kingdom
* United States of America
* Yemen
-biggs is tested to behave well with Rails 3.0, 3.1, 3.2 and 4.0
+biggs is tested to behave well with Rails 3 to 7
-Copyright (c) 2009-2013 Yolk Sebastian Munz & Julia Soergel GbR
+Copyright (c) 2009-2022 Yolk Sebastian Munz & Julia Soergel GbR