rabl-rails/lib/rabl-rails.rb

39 lines
865 B
Ruby
Raw Normal View History

2012-02-22 18:14:00 +00:00
require 'rails/railtie'
require 'active_support'
require 'active_support/json'
require 'active_support/core_ext/class/attribute_accessors'
2012-04-20 14:28:34 +00:00
require 'rabl-rails/version'
require 'rabl-rails/template'
require 'rabl-rails/compiler'
2012-04-20 14:28:34 +00:00
require 'rabl-rails/renderer'
2012-04-20 14:28:34 +00:00
require 'rabl-rails/library'
require 'rabl-rails/handler'
require 'rabl-rails/railtie'
2012-02-22 18:14:00 +00:00
2012-04-20 14:28:34 +00:00
module RablRails
2012-07-03 15:45:23 +00:00
autoload :Responder, 'rabl-rails/responder'
2012-04-02 14:22:43 +00:00
mattr_accessor :cache_templates
@@cache_templates = true
2012-07-03 15:45:23 +00:00
mattr_accessor :use_custom_responder
@@use_custom_responder = false
mattr_accessor :responder_default_template
@@responder_default_template = 'show'
def self.configure
2012-04-02 14:22:43 +00:00
yield self
2012-07-03 15:45:23 +00:00
ActionController::Base.responder = Responder if self.use_custom_responder
2012-04-02 14:22:43 +00:00
end
2012-07-03 15:45:23 +00:00
def self.cache_templates?
2012-04-02 14:22:43 +00:00
ActionController::Base.perform_caching && @@cache_templates
end
2012-02-22 10:42:38 +00:00
end