class PLA::Vessel
Public Class Methods
new(name, country, agent)
click to toggle source
# File lib/pla/vessel.rb, line 5 def initialize name, country, agent @name = name @country = normalise_country(country) @agent = agent end
Public Instance Methods
normalise_country(country_code)
click to toggle source
# File lib/pla/vessel.rb, line 20 def normalise_country country_code begin country = IsoCountryCodes.find(country_code).name rescue IsoCountryCodes::UnknownCodeError STDERR.puts "WARNING: Invalid country code #{country_code.upcase}" country = country_code end country end
to_h()
click to toggle source
# File lib/pla/vessel.rb, line 11 def to_h { name: @name, country: @country, agent: @agent, google: "https://www.google.co.uk/search?q=site:vesselfinder.com #{@name}" } end