class WeatherGov::Identifier
Constants
- TYPES
Attributes
uri[R]
Public Class Methods
base_uri()
click to toggle source
# File lib/weather_gov/identifier.rb, line 15 def self.base_uri API_BASE_URI end
new(uri)
click to toggle source
# File lib/weather_gov/identifier.rb, line 19 def initialize(uri) @uri = uri end
parse(uri)
click to toggle source
# File lib/weather_gov/identifier.rb, line 7 def self.parse(uri) TYPES.each do |type| return type.new(uri) if uri.start_with?(type.base_uri) end nil end
Public Instance Methods
id()
click to toggle source
# File lib/weather_gov/identifier.rb, line 27 def id uri.sub(/^#{self.class.base_uri}/, "") end
to_s()
click to toggle source
# File lib/weather_gov/identifier.rb, line 23 def to_s id end