Class: Fleakr::Objects::PhotoContext
- Inherits:
-
Object
- Object
- Fleakr::Objects::PhotoContext
- Includes:
- Support::Object
- Defined in:
- lib/fleakr/objects/photo_context.rb
Overview
PhotoContext
This class represents the context for a photo as retrieved from the API. It’s not intended to be used directly, but is used in conjunction with Photo#previous and Photo#next
Attributes
- count
-
The number of photos available
Instance Method Summary collapse
-
#next ⇒ Object
The next photo if one is available.
-
#next? ⇒ Boolean
Is there a next photo available for the current photo?.
-
#previous ⇒ Object
The previous photo if one is available.
-
#previous? ⇒ Boolean
Is there a previous photo available for the current photo?.
Methods included from Support::Object
Instance Method Details
#next ⇒ Object
The next photo if one is available
42 43 44 |
# File 'lib/fleakr/objects/photo_context.rb', line 42 def next Photo.find_by_id(next_id) if next? end |
#next? ⇒ Boolean
Is there a next photo available for the current photo?
36 37 38 |
# File 'lib/fleakr/objects/photo_context.rb', line 36 def next? next_id != '0' end |
#previous ⇒ Object
The previous photo if one is available
30 31 32 |
# File 'lib/fleakr/objects/photo_context.rb', line 30 def previous Photo.find_by_id(previous_id) if previous? end |
#previous? ⇒ Boolean
Is there a previous photo available for the current photo?
24 25 26 |
# File 'lib/fleakr/objects/photo_context.rb', line 24 def previous? previous_id != '0' end |