Class: MySociety::MapIt::Postcode
- Inherits:
-
Object
- Object
- MySociety::MapIt::Postcode
- Includes:
- LocalAuthorityFinder, UriToHash
- Defined in:
- lib/my_society/map_it.rb
Constant Summary
Constants included from LocalAuthorityFinder
LocalAuthorityFinder::LOCAL_AUTHORITY_TYPE_CODES
Instance Attribute Summary collapse
-
#postcode ⇒ Object
readonly
Returns the value of attribute postcode.
Instance Method Summary collapse
-
#initialize(postcode) ⇒ Postcode
constructor
A new instance of Postcode.
- #normalised_postcode ⇒ Object
- #to_point ⇒ Object
- #uri ⇒ Object
Methods included from UriToHash
Methods included from LocalAuthorityFinder
Constructor Details
#initialize(postcode) ⇒ Postcode
Returns a new instance of Postcode.
106 107 108 |
# File 'lib/my_society/map_it.rb', line 106 def initialize postcode self.postcode = postcode end |
Instance Attribute Details
#postcode ⇒ Object
Returns the value of attribute postcode.
103 104 105 |
# File 'lib/my_society/map_it.rb', line 103 def postcode @postcode end |
Instance Method Details
#normalised_postcode ⇒ Object
110 111 112 |
# File 'lib/my_society/map_it.rb', line 110 def normalised_postcode postcode.upcase.gsub /\s+/, '' end |
#to_point ⇒ Object
118 119 120 121 |
# File 'lib/my_society/map_it.rb', line 118 def to_point h = to_hash.dup Point.new h['wgs84_lon'], h['wgs84_lat'], Point::SYSTEM_WGS84 end |