Class: Relaxo::Model::Path

Inherits:
String
  • Object
show all
Defined in:
lib/relaxo/model/path.rb

Overview

A string that won’t be escaped when concatenating with a path:

Constant Summary collapse

ENCODE =
{'/' => '%2F', '%' => '%25'}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.escape(values) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/relaxo/model/path.rb', line 35

def self.escape(values)
	escaped_path = values.map do |part|
		part = part.to_s
		
		if part.is_a? Path
			part
		else
			part.to_s.gsub(/[\/%]/, ENCODE)
		end
	end.join('-')
	
	return self.new(escaped_path)
end

Instance Method Details

#to_sObject



27
28
29
# File 'lib/relaxo/model/path.rb', line 27

def to_s
	self
end

#to_strObject



31
32
33
# File 'lib/relaxo/model/path.rb', line 31

def to_str
	self
end