module Kanoko

This is an experimental implementation. You can set configure and other. This application receve url make by Kanoko.url_for(). You can choice function that image processing. Image resource can get by url, And that write once to file, And image processing by imagemagick, And that read file binary.

example:

require 'kanoko/application/convert'

ENV['KANOKO_DIGEST_FUNC'] = "sha1"
ENV['KANOKO_SECRET_KEY'] = "secret"

class MyApp < Kanoko::Application::Convert
  before do
    content_type 'image/png'
  end
  configure :production do
    require 'newrelic_rpm'
  end
end

run MyApp

Constants

VERSION

Public Class Methods

configure() { |configure| ... } click to toggle source

example:

Kanoko.configure.digest_func = "sha1"
p Kanoko.configure #=> #<Kanoko::Configure ...>
# File lib/kanoko.rb, line 10
def configure
  @configure ||= Configure.new
  if block_given?
    yield @configure
  else
    @configure
  end
end
configure=(value) click to toggle source
# File lib/kanoko.rb, line 20
def configure=(value)
  @configure = value
end
make_hash(*args) click to toggle source
# File lib/kanoko.rb, line 31
def make_hash(*args)
  configure.hash_proc.call(*args)
end
path_for(*function, src) click to toggle source
# File lib/kanoko.rb, line 25
def path_for(*function, src)
  hash = make_hash(*function, src)
  "/#{hash}/#{function.map { |i| URI.encode_www_form_component(i) }.join('/')}/#{src}"
end

Private Instance Methods

configure() { |configure| ... } click to toggle source

example:

Kanoko.configure.digest_func = "sha1"
p Kanoko.configure #=> #<Kanoko::Configure ...>
# File lib/kanoko.rb, line 10
def configure
  @configure ||= Configure.new
  if block_given?
    yield @configure
  else
    @configure
  end
end
configure=(value) click to toggle source
# File lib/kanoko.rb, line 20
def configure=(value)
  @configure = value
end
make_hash(*args) click to toggle source
# File lib/kanoko.rb, line 31
def make_hash(*args)
  configure.hash_proc.call(*args)
end
path_for(*function, src) click to toggle source
# File lib/kanoko.rb, line 25
def path_for(*function, src)
  hash = make_hash(*function, src)
  "/#{hash}/#{function.map { |i| URI.encode_www_form_component(i) }.join('/')}/#{src}"
end