Class: RGallery::Photo
- Inherits:
-
Object
- Object
- RGallery::Photo
- Defined in:
- lib/rails-gallery/rgallery/photo.rb
Class Attribute Summary collapse
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #alt ⇒ Object
- #description ⇒ Object
- #extension ⇒ Object
- #file_path ⇒ Object
- #filename ⇒ Object
-
#initialize(id, options = {}) ⇒ Photo
constructor
A new instance of Photo.
- #path ⇒ Object
- #thumb ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(id, options = {}) ⇒ Photo
Returns a new instance of Photo.
5 6 7 8 |
# File 'lib/rails-gallery/rgallery/photo.rb', line 5 def initialize id, = {} @id = id @options = end |
Class Attribute Details
.extension ⇒ Object
45 46 47 |
# File 'lib/rails-gallery/rgallery/photo.rb', line 45 def extension @extension ||= :png end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/rails-gallery/rgallery/photo.rb', line 3 def id @id end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/rails-gallery/rgallery/photo.rb', line 3 def @options end |
Instance Method Details
#alt ⇒ Object
30 31 32 |
# File 'lib/rails-gallery/rgallery/photo.rb', line 30 def alt 'no alt' end |
#description ⇒ Object
34 35 36 |
# File 'lib/rails-gallery/rgallery/photo.rb', line 34 def description 'no description' end |
#extension ⇒ Object
38 39 40 |
# File 'lib/rails-gallery/rgallery/photo.rb', line 38 def extension [:extension] || self.class.extension end |
#file_path ⇒ Object
14 15 16 |
# File 'lib/rails-gallery/rgallery/photo.rb', line 14 def file_path "#{filename}.#{extension}" end |
#filename ⇒ Object
10 11 12 |
# File 'lib/rails-gallery/rgallery/photo.rb', line 10 def filename id end |
#path ⇒ Object
18 19 20 |
# File 'lib/rails-gallery/rgallery/photo.rb', line 18 def path file_path end |
#thumb ⇒ Object
22 23 24 |
# File 'lib/rails-gallery/rgallery/photo.rb', line 22 def thumb path end |
#title ⇒ Object
26 27 28 |
# File 'lib/rails-gallery/rgallery/photo.rb', line 26 def title 'no title' end |