Class: Spyke::Path

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

Instance Method Summary collapse

Constructor Details

#initialize(pattern, params = {}) ⇒ Path

Returns a new instance of Path.



7
8
9
10
# File 'lib/spyke/path.rb', line 7

def initialize(pattern, params = {})
  @pattern = pattern
  @params = params.symbolize_keys
end

Instance Method Details

#join(other_path) ⇒ Object



12
13
14
# File 'lib/spyke/path.rb', line 12

def join(other_path)
  self.class.new File.join(path, other_path.to_s), @params
end

#to_sObject



16
17
18
# File 'lib/spyke/path.rb', line 16

def to_s
  path
end

#variablesObject



20
21
22
# File 'lib/spyke/path.rb', line 20

def variables
  @variables ||= uri_template.variables.map(&:to_sym)
end