Sha256: 333e4cf55ad70afe789e99f611fbe955f1c96a5a4981bb0b0aeac14b9f1d95cb
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
module RenderExecJS module Configuration extend ActiveSupport::Concern included do add_config :environment, :with => "RenderExecJS::Renderer.environment" add_setter :coffeescript_environment, :with => "RenderExecJS::Renderer.coffeescript_environment" end module ClassMethods def configure &block instance_exec &block end private def add_config name, options = {} options[:with] ||= "@@#{name}" class_eval <<-RUBY class << self def #{name} new_#{name} #{'= nil' unless options[:setter]} #{options[:with]} = new_#{name} #{"unless new_#{name}.nil?" unless options[:setter]} #{options[:with] unless options[:setter]} end def #{name}= new_#{name} #{options[:with]} = new_#{name} end end RUBY send "#{name}=", nil end def add_setter name, options = {} add_config name, {:setter => true}.merge(options) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
render_execjs-0.0.3 | lib/render_execjs/configuration.rb |
render_execjs-0.0.2 | lib/render_execjs/configuration.rb |