Class: Uttk::Logger::Segment

Inherits:
Object
  • Object
show all
Defined in:
lib/uttk/logger/path.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(segment, options = nil) ⇒ Segment

Returns a new instance of Segment.



14
15
16
17
# File 'lib/uttk/logger/path.rb', line 14

def initialize ( segment, options=nil )
  raise if segment.is_a? Segment
  @segment, @options = segment, (options || {})
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



13
14
15
# File 'lib/uttk/logger/path.rb', line 13

def options
  @options
end

#segmentObject

Returns the value of attribute segment.



13
14
15
# File 'lib/uttk/logger/path.rb', line 13

def segment
  @segment
end

Class Method Details

.quote(s) ⇒ Object



24
25
26
# File 'lib/uttk/logger/path.rb', line 24

def self.quote ( s )
  s.gsub(/(?:([\/\]\[])|\\(.))/, '\\\\\1\2')
end

Instance Method Details

#==(rhs) ⇒ Object



21
22
23
# File 'lib/uttk/logger/path.rb', line 21

def == ( rhs )
  rhs.is_a?(self.class) && @segment == rhs.segment && @options == rhs.options
end

#initialize_copy(rhs) ⇒ Object



18
19
20
# File 'lib/uttk/logger/path.rb', line 18

def initialize_copy ( rhs )
  @segment, @options = rhs.segment.try_dup, rhs.options.dup
end

#quoted_segmentObject



27
28
29
# File 'lib/uttk/logger/path.rb', line 27

def quoted_segment
  Segment.quote(@segment.to_s)
end

#regexp_quoted_segmentObject



30
31
32
# File 'lib/uttk/logger/path.rb', line 30

def regexp_quoted_segment
  Segment.quote(Regexp.quote(@segment.to_s))
end