Class: Errapi::Locations::Json
- Inherits:
-
Object
- Object
- Errapi::Locations::Json
- Defined in:
- lib/errapi/locations/json.rb
Instance Method Summary collapse
- #===(location) ⇒ Object
-
#initialize(location = nil) ⇒ Json
constructor
A new instance of Json.
- #location_type ⇒ Object
- #relative(parts) ⇒ Object
- #serialize ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(location = nil) ⇒ Json
Returns a new instance of Json.
5 6 7 |
# File 'lib/errapi/locations/json.rb', line 5 def initialize location = nil @location = location.nil? ? '' : "/#{location.to_s.sub(/^\//, '').sub(/\/$/, '')}" end |
Instance Method Details
#===(location) ⇒ Object
25 26 27 |
# File 'lib/errapi/locations/json.rb', line 25 def === location @location.to_s == location.to_s end |
#location_type ⇒ Object
17 18 19 |
# File 'lib/errapi/locations/json.rb', line 17 def location_type :json end |
#relative(parts) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/errapi/locations/json.rb', line 9 def relative parts if @location.nil? self.class.new parts else self.class.new "#{@location}/#{parts.to_s.sub(/^\./, '').sub(/\/$/, '')}" end end |
#serialize ⇒ Object
21 22 23 |
# File 'lib/errapi/locations/json.rb', line 21 def serialize @location end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/errapi/locations/json.rb', line 29 def to_s @location end |