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.
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
#expanded ⇒ Object
18 19 20 |
# File 'lib/pdc/resource/path.rb', line 18 def 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_s ⇒ Object
14 15 16 |
# File 'lib/pdc/resource/path.rb', line 14 def to_s @pattern end |
#variables ⇒ Object
22 23 24 |
# File 'lib/pdc/resource/path.rb', line 22 def variables @variables ||= uri_template.variables.map(&:to_sym) end |