aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Geocode/Address.pm
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2018-06-07 13:28:45 +0200
committerMarius Halden <marius.h@lden.org>2018-06-07 13:28:45 +0200
commit956f8b8a065824f9a9dc379eba1d0aa8b1b669cf (patch)
tree49f9ccb147b18dddee97500d4df7a3fb3dd3737c /perllib/FixMyStreet/Geocode/Address.pm
parent782457d016084c8de04989dbc824a71899f8b41b (diff)
parent4dbf5371f79c5f290c08e561ba2c881e96b58669 (diff)
Merge tag 'v2.3.3' into fiksgatami-dev
Diffstat (limited to 'perllib/FixMyStreet/Geocode/Address.pm')
-rw-r--r--perllib/FixMyStreet/Geocode/Address.pm28
1 files changed, 28 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Geocode/Address.pm b/perllib/FixMyStreet/Geocode/Address.pm
new file mode 100644
index 000000000..522091f62
--- /dev/null
+++ b/perllib/FixMyStreet/Geocode/Address.pm
@@ -0,0 +1,28 @@
+package FixMyStreet::Geocode::Address;
+
+use strict;
+use warnings;
+
+use overload '""' => \&as_string, fallback => 1;
+
+sub new {
+ my ($class, $data) = @_;
+ my $self = { %$data };
+ bless $self, $class;
+}
+
+sub as_string {
+ my $self = shift;
+
+ my $data = sprintf(_("Nearest road to the pin placed on the map (automatically generated by Bing Maps): %s"),
+ $self->{name}) . "\n\n";
+
+ if ($self->{postcode}) {
+ $data .= sprintf(_("Nearest postcode to the pin placed on the map (automatically generated): %s (%sm away)"),
+ $self->{postcode}{postcode}, $self->{postcode}{distance}) . "\n\n";
+ }
+
+ return $data;
+}
+
+1;