Class: String

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

Instance Method Summary collapse

Instance Method Details

#has_leading_slash?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/skypager/core_ext.rb', line 10

def has_leading_slash?
  match(/^\//)
end

#with_leading_slashObject



2
3
4
5
6
7
8
# File 'lib/skypager/core_ext.rb', line 2

def with_leading_slash
  if match(/^\//)
    self
  else
    "/#{self}"
  end
end

#without_leading_slashObject



14
15
16
17
18
19
20
# File 'lib/skypager/core_ext.rb', line 14

def without_leading_slash
  if has_leading_slash?
    gsub(/^\//,'')
  else
    self
  end
end