Sha256: d07cde116d734bf64c4f78d312696653fb7d06f75d3b3c876d86717777d37a18
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
require 'httpimagestore/thumbnail_class' require 'pathname' class Configuration def initialize(&block) @thumbnail_classes = {} @thumbnailer_url = "http://localhost:3100" @port = 3000 @bind = 'localhost' instance_eval &block end def self.from_file(file) file = Pathname.pwd + file Configuration.new do eval(file.read, nil, file) end end def thumbnail_class(name, method, width, height, format = 'JPEG', options = {}) @thumbnail_classes[name] = ThumbnailClass.new(name, method, width, height, format, options) end def s3_key(id, secret) @s3_key_id = id @s3_key_secret = secret end def s3_bucket(bucket) @s3_bucket = bucket end def thumbnailer_url(url) @thumbnailer_url = url end def port(no) @port = no end def bind(address) @bind = address end def get Struct.new(:thumbnail_classes, :s3_key_id, :s3_key_secret, :s3_bucket, :thumbnailer_url, :port, :bind).new(@thumbnail_classes, @s3_key_id, @s3_key_secret, @s3_bucket, @thumbnailer_url, @port, @bind) end def put(sinatra) get.each_pair do |key, value| sinatra.set key, value end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
httpimagestore-0.0.1 | lib/httpimagestore/configuration.rb |