Class: PDC::Resource::Path
- Inherits:
-
Object
- Object
- PDC::Resource::Path
- Defined in:
- lib/pdc/resource/path.rb
Instance Method Summary collapse
- #expanded ⇒ Object
-
#initialize(pattern, params = {}) ⇒ Path
constructor
A new instance of Path.
- #join(other_path) ⇒ Object
- #to_s ⇒ Object
- #variables ⇒ Object
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
#expanded ⇒ Object
19 20 21 |
# File 'lib/pdc/resource/path.rb', line 19 def 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_s ⇒ Object
15 16 17 |
# File 'lib/pdc/resource/path.rb', line 15 def to_s @pattern end |
#variables ⇒ Object
23 24 25 |
# File 'lib/pdc/resource/path.rb', line 23 def variables @variables ||= uri_template.variables.map(&:to_sym) end |