Class: Yarrow::Web::URL
- Inherits:
-
Object
- Object
- Yarrow::Web::URL
- Defined in:
- lib/yarrow/web/url.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path) ⇒ URL
constructor
A new instance of URL.
- #to_s ⇒ Object
Constructor Details
#initialize(path) ⇒ URL
Returns a new instance of URL.
20 21 22 |
# File 'lib/yarrow/web/url.rb', line 20 def initialize(path) @path = path end |
Class Method Details
.generate(resource) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/yarrow/web/url.rb', line 7 def self.generate(resource) path = if resource.respond_to?(:url) resource.url elsif resource.respond_to?(:permalink) resource.permalink else # TODO: URL generation strategy "/one/two/three" end new(path) end |
Instance Method Details
#to_s ⇒ Object
24 25 26 |
# File 'lib/yarrow/web/url.rb', line 24 def to_s @path end |