Class: FAFuse::Picture
- Inherits:
-
Object
- Object
- FAFuse::Picture
- Defined in:
- lib/fafuse/picture.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #content ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(path) ⇒ Picture
constructor
A new instance of Picture.
- #stat ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/fafuse/picture.rb', line 6 def id @id end |
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/fafuse/picture.rb', line 6 def path @path end |
Class Method Details
.match?(path) ⇒ Boolean
8 9 10 |
# File 'lib/fafuse/picture.rb', line 8 def self.match?(path) path.match(/^\/[^\.][^\/]+\/gallery\/([^\.][^\/]+)$/) end |
Instance Method Details
#content ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/fafuse/picture.rb', line 38 def content if exists? [ "metadata.json", "file#{format}" ] else raise Errno::ENOENT.new(path) end end |
#exists? ⇒ Boolean
32 33 34 35 36 |
# File 'lib/fafuse/picture.rb', line 32 def exists? Helpers::fa_is_valid?(document) rescue RestClient::NotFound false end |
#stat ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/fafuse/picture.rb', line 22 def stat RFuse::Stat.directory(0555, { :uid => 0, :gid => 0, :atime => Time.now, :mtime => Time.now, :size => 0 }) end |
#valid? ⇒ Boolean
18 19 20 |
# File 'lib/fafuse/picture.rb', line 18 def valid? !!id end |