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.



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

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

Instance Method Details

#expandedObject



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

def expanded
  path.to_s
end

#join(other_path) ⇒ Object



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

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

#to_sObject



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

def to_s
  @pattern
end

#variablesObject



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

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