Sha256: fb37e8be2863147b1f9b972d68d8a026ab1697ffe6a07028b79e74447a8e2327
Contents?: true
Size: 846 Bytes
Versions: 1
Compression:
Stored size: 846 Bytes
Contents
require 'uri' require 'kanoko/configure' module Kanoko # example: # Kanoko.configure.kanoko_host = "http://example.com" # p Kanoko.configure #=> #<Kanoko::Configure ...> def configure @configure ||= Configure.new end module_function :configure def configure=(value) @configure = value end def url_for(func, args, src) if configure.kanoko_host.nil? fail ConfigureError, "`kanoko_host' must be set" end "#{configure.kanoko_host}#{make_path(func, args, src)}" end module_function :url_for def make_hash(*args) configure.hash_proc.call(*args) end module_function :make_hash private def make_path(func, args, src) hash = make_hash(func, args, src) "/#{hash}/#{[func, args, src].map{|i| URI.encode_www_form_component(i)}.join('/')}" end module_function :make_path end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kanoko-0.0.2 | lib/kanoko.rb |