Class: Imagery
- Inherits:
-
Object
- Object
- Imagery
- Includes:
- Core
- Defined in:
- lib/imagery.rb,
lib/imagery/s3.rb,
lib/imagery/test.rb,
lib/imagery/faking.rb
Defined Under Namespace
Modules: Core, Faking, GM, S3, Test
Constant Summary collapse
- VERSION =
"0.2.0"
- InvalidImage =
Raised during Imagery#save if the image can’t be recognized.
Class.new(StandardError)
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
A unique id for the image.
-
#prefix ⇒ Object
readonly
Acts as a namespace, e.g.
-
#sizes ⇒ Object
readonly
A hash of name => tuple pairs.
Class Method Summary collapse
Instance Method Summary collapse
-
#ext(file) ⇒ Object
Returns the base filename together with the extension, which defaults to jpg.
- #root(*args) ⇒ Object
Methods included from Core
#delete, #initialize, #save, #url
Instance Attribute Details
#key ⇒ Object (readonly)
A unique id for the image.
18 19 20 |
# File 'lib/imagery.rb', line 18 def key @key end |
#prefix ⇒ Object (readonly)
Acts as a namespace, e.g. ‘photos`.
15 16 17 |
# File 'lib/imagery.rb', line 15 def prefix @prefix end |
#sizes ⇒ Object (readonly)
A hash of name => tuple pairs. The name describes the size, e.g. ‘small`.
-
The first element if the tuple is the resize geometry.
-
The second (optional) element describes the extent.
31 32 33 |
# File 'lib/imagery.rb', line 31 def sizes @sizes end |
Class Method Details
.root(*args) ⇒ Object
117 118 119 |
# File 'lib/imagery.rb', line 117 def self.root(*args) File.join(@root, *args) end |
.root=(path) ⇒ Object
121 122 123 |
# File 'lib/imagery.rb', line 121 def self.root=(path) @root = path end |
Instance Method Details
#ext(file) ⇒ Object
Returns the base filename together with the extension, which defaults to jpg.
109 110 111 |
# File 'lib/imagery.rb', line 109 def ext(file) "#{file}.#{@ext}" end |
#root(*args) ⇒ Object
113 114 115 |
# File 'lib/imagery.rb', line 113 def root(*args) self.class.root(prefix, key, *args) end |