Class: Symbol

Inherits:
Object
  • Object
show all
Defined in:
lib/modesty/core_ext/symbol.rb

Instance Method Summary collapse

Instance Method Details

#/(other) ⇒ Object



3
4
5
# File 'lib/modesty/core_ext/symbol.rb', line 3

def /(other)
  :"#{self}/#{other}"
end

#<=>(other) ⇒ Object



30
31
32
# File 'lib/modesty/core_ext/symbol.rb', line 30

def <=>(other)
  self.to_s <=> other.to_s
end

#__old_inspectObject



8
# File 'lib/modesty/core_ext/symbol.rb', line 8

alias __old_inspect inspect

#inspectObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/modesty/core_ext/symbol.rb', line 9

def inspect
  s = self.to_s

  #some things should not use this.
  if (
    s[0..0] == '/' ||
    s[-1..-1] == '/' ||
    s.include?("//") ||
    s.include?(":")
  )
    return self.__old_inspect
  end

  begin
    inspected = self.to_s.split(/\//).map { |s| ":#{s}"}.join('/')
    return inspected
  rescue
    return self.__old_inspect
  end
end