Class: Snapshot::URL
- Inherits:
-
Object
- Object
- Snapshot::URL
- Defined in:
- lib/snapshot/url.rb
Instance Attribute Summary collapse
-
#extension ⇒ Object
readonly
Returns the value of attribute extension.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(id, extension, &block) ⇒ URL
constructor
A new instance of URL.
- #method_missing(processor, *options) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(id, extension, &block) ⇒ URL
Returns a new instance of URL.
5 6 7 8 9 10 |
# File 'lib/snapshot/url.rb', line 5 def initialize(id, extension, &block) @id = id @extension = extension @options = [] tap(&block) if block_given? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(processor, *options) ⇒ Object
12 13 14 |
# File 'lib/snapshot/url.rb', line 12 def method_missing(processor, *) @options << [":#{processor}", ] end |
Instance Attribute Details
#extension ⇒ Object (readonly)
Returns the value of attribute extension.
3 4 5 |
# File 'lib/snapshot/url.rb', line 3 def extension @extension end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/snapshot/url.rb', line 3 def id @id end |
Instance Method Details
#to_s ⇒ Object
16 17 18 19 20 |
# File 'lib/snapshot/url.rb', line 16 def to_s = @options.flatten << '' unless .empty? "#{Snapshot.connection.url}#{.join('/')}#{id}.#{extension}" end |