Object
This is class returned by StreetAddress::US::parse, StreetAddress::US::parse_address and StreetAddress::US::parse_intersection. If an instance represents an intersection the attribute street2 will be populated.
# File lib/street_address.rb, line 848 def intersection? !street2.nil? end
# File lib/street_address.rb, line 852 def line1(s = "") return if intersection? s += number s += " " + prefix unless prefix.nil? s += " " + street unless street.nil? s += " " + street_type unless street_type.nil? if( !unit_prefix.nil? && !unit.nil? ) s += " " + unit_prefix s += " " + unit elsif( unit_prefix.nil? && !unit.nil? ) s += " #" + unit end s += " " + suffix unless suffix.nil? return s end
# File lib/street_address.rb, line 840 def state_fips StreetAddress::US::FIPS_STATES[state] end
# File lib/street_address.rb, line 844 def state_name name = StreetAddress::US::STATE_NAMES[state] and name.capitalize end
# File lib/street_address.rb, line 868 def to_s(format = :default) s = "" case format when :line1 s += line1(s) else if intersection? s += prefix + " " unless prefix.nil? s += street s += " " + street_type unless street_type.nil? s += " " + suffix unless suffix.nil? s += " and" s += " " + prefix2 unless prefix2.nil? s += " " + street2 s += " " + street_type2 unless street_type2.nil? s += " " + suffix2 unless suffix2.nil? s += ", " + city unless city.nil? s += ", " + state unless state.nil? s += " " + postal_code unless postal_code.nil? else s += line1(s) s += ", " + city unless city.nil? s += ", " + state unless state.nil? s += " " + postal_code unless postal_code.nil? s += "-" + postal_code_ext unless postal_code_ext.nil? end end return s end
Generated with the Darkfish Rdoc Generator 2.