Class: PDC::Resource::Path

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Path.



5
6
7
8
# File 'lib/pdc/resource/path.rb', line 5

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

Instance Method Details

#expandedObject



18
19
20
# File 'lib/pdc/resource/path.rb', line 18

def expanded
  path.to_s
end

#join(other_path) ⇒ Object



10
11
12
# File 'lib/pdc/resource/path.rb', line 10

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

#to_sObject



14
15
16
# File 'lib/pdc/resource/path.rb', line 14

def to_s
  @pattern
end

#variablesObject



22
23
24
# File 'lib/pdc/resource/path.rb', line 22

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