Class: FormattedURL::Strategies::DefaultURLStrategy
- Inherits:
-
Object
- Object
- FormattedURL::Strategies::DefaultURLStrategy
- Defined in:
- lib/formatted_url/strategies/default_url_strategy.rb
Overview
Default strategy to manage paths. Returns the path
by default
Direct Known Subclasses
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
The URL path.
Class Method Summary collapse
-
.url(path, format) ⇒ Object
Formats
path
for a givenformat
.
Instance Method Summary collapse
-
#default ⇒ Object
Returns
path
by default. -
#initialize(path) ⇒ DefaultURLStrategy
constructor
Receives URL
path
. -
#method_missing(*args) ⇒ Object
Returns default path when receive unknown message.
Constructor Details
#initialize(path) ⇒ DefaultURLStrategy
Receives URL path
18 19 20 |
# File 'lib/formatted_url/strategies/default_url_strategy.rb', line 18 def initialize(path) @path = path end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
Returns default path when receive unknown message
29 30 31 |
# File 'lib/formatted_url/strategies/default_url_strategy.rb', line 29 def method_missing(*args) default end |
Instance Attribute Details
#path ⇒ Object (readonly)
The URL path
10 11 12 |
# File 'lib/formatted_url/strategies/default_url_strategy.rb', line 10 def path @path end |
Class Method Details
.url(path, format) ⇒ Object
Formats path
for a given format
13 14 15 |
# File 'lib/formatted_url/strategies/default_url_strategy.rb', line 13 def self.url(path, format) new(path).send(format) end |
Instance Method Details
#default ⇒ Object
Returns path
by default
23 24 25 |
# File 'lib/formatted_url/strategies/default_url_strategy.rb', line 23 def default path end |