Class: Errapi::Locations::Dotted

Inherits:
Object
  • Object
show all
Defined in:
lib/errapi/locations/dotted.rb

Instance Method Summary collapse

Constructor Details

#initialize(location = nil) ⇒ Dotted

Returns a new instance of Dotted.



5
6
7
# File 'lib/errapi/locations/dotted.rb', line 5

def initialize location = nil
  @location = location.to_s.sub /^\./, '' unless location.nil?
end

Instance Method Details

#===(location) ⇒ Object



25
26
27
# File 'lib/errapi/locations/dotted.rb', line 25

def === location
  @location.to_s == location.to_s
end

#location_typeObject



17
18
19
# File 'lib/errapi/locations/dotted.rb', line 17

def location_type
  :dotted
end

#relative(parts) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/errapi/locations/dotted.rb', line 9

def relative parts
  if @location.nil?
    self.class.new parts
  else
    self.class.new "#{@location}.#{parts.to_s.sub(/^\./, '')}"
  end
end

#serializeObject



21
22
23
# File 'lib/errapi/locations/dotted.rb', line 21

def serialize
  @location.nil? ? nil : @location
end

#to_sObject



29
30
31
# File 'lib/errapi/locations/dotted.rb', line 29

def to_s
  @location.to_s
end