Class: Stic::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/stic/utils.rb

Class Method Summary collapse

Class Method Details

.with_leading_slash(path) ⇒ Object



11
12
13
# File 'lib/stic/utils.rb', line 11

def with_leading_slash(path)
  path[0] == '/' ? path : "/#{path}"
end

.with_trailing_slash(path) ⇒ Object



7
8
9
# File 'lib/stic/utils.rb', line 7

def with_trailing_slash(path)
  path[-1] == '/' ? path : "#{path}/"
end

.without_leading_slash(path) ⇒ Object



15
16
17
# File 'lib/stic/utils.rb', line 15

def without_leading_slash(path)
  path.to_s.sub(/^[\/]+/, '')
end