lib/smoke.rb in benschwarz-smoke-0.4.1 vs lib/smoke.rb in benschwarz-smoke-0.4.2
- old
+ new
@@ -7,19 +7,24 @@
module Smoke
class << self
@@active_sources = {}
@@config = {
:enable_logging => true,
- :user_agent => "Ruby/#{RUBY_VERSION}/Smoke"
+ :user_agent => "Ruby/#{RUBY_VERSION}/Smoke",
+ :cache => {
+ :enabled => false,
+ :store => :memory,
+ :options => {},
+ :expiry => 1800
+ }
}
# Access registered smoke source instances
#
- # Usage:
- #
+ # Define your source:
# Smoke.yql(:ruby) do ....
- #
+ # Then access it:
# Smoke[:ruby]
# => #<Smoke::Source::YQL::0x18428d4...
def [](source)
active_sources[source]
end
@@ -64,10 +69,11 @@
# c[:user_agent] = "Some other site"
# end
#
def configure(&block)
yield @@config
+ Smoke::Cache.configure!
end
# Access configuration options
#
# Smoke.config[:option_name]
@@ -88,10 +94,10 @@
# end
def join(*names, &block); Smoke::Source::Join.new(names, &block); end
end
end
-%w(core_ext/hash smoke/request smoke/origin).each {|r| require File.join(File.dirname(__FILE__), r)}
+%w(core_ext/hash smoke/cache smoke/request smoke/origin).each {|r| require File.join(File.dirname(__FILE__), r)}
class Object # :nodoc:
include Smoke
end
\ No newline at end of file