Module: Minimage

Extended by:
Minimage
Included in:
Minimage
Defined in:
lib/minimage.rb,
lib/minimage/storage.rb,
lib/minimage/version.rb,
lib/minimage/processor.rb,
lib/minimage/storage/file.rb,
lib/minimage/processor/mini_magick.rb

Defined Under Namespace

Modules: Processor, Storage

Constant Summary collapse

Error =
Class.new(Nesty::NestedStandardError)
VERSION =
"0.0.1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#processorObject

Returns the value of attribute processor.



10
11
12
# File 'lib/minimage.rb', line 10

def processor
  @processor
end

#storageObject

Returns the value of attribute storage.



10
11
12
# File 'lib/minimage.rb', line 10

def storage
  @storage
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Minimage)

    the object that the method was called on



20
21
22
# File 'lib/minimage.rb', line 20

def configure
  yield self
end

#fetch(uid) ⇒ Object



36
37
38
# File 'lib/minimage.rb', line 36

def fetch(uid)
  storage.fetch!(uid)
end

#process(stream, format = nil, &block) ⇒ Object



24
25
26
27
28
# File 'lib/minimage.rb', line 24

def process(stream, format = nil, &block)
  p = processor.call(stream, format)
  block.call(p)
  p.stream
end

#store(path) ⇒ Object



30
31
32
33
34
# File 'lib/minimage.rb', line 30

def store(path)
  storage.store!(path)
rescue => e
  raise Error.new
end