Sha256: ffb3bb05fbb9b54cb3c89b85c4af7d09df8a45b3d07509eea178d1b2df14ac40
Contents?: true
Size: 1.74 KB
Versions: 6
Compression:
Stored size: 1.74 KB
Contents
require 'rails' module GhostInThePost ATTRIBUTE_NAMES = [ :phantomjs_path, :includes, :remove_js_tags, :timeout, :wait_event, :debug, ] DEFAULT_TIMEOUT = 1000 DEFAULT_WAIT_EVENT = "ghost_in_the_post:done" private_constant :ATTRIBUTE_NAMES cattr_reader(*ATTRIBUTE_NAMES) #defaults @@phantomjs_path = nil #setting this to nil helps testing @@timeout = DEFAULT_TIMEOUT @@wait_event = DEFAULT_WAIT_EVENT @@includes = [] @@remove_js_tags = true @@debug = false def self.config=(new_config={}) self.complain_about_unknown_keys(new_config.keys) @@phantomjs_path = new_config[:phantomjs_path] @@includes = Array(new_config[:includes]) @@remove_js_tags = new_config[:remove_js_tags].nil? ? true : new_config[:remove_js_tags] @@timeout = new_config[:timeout] || DEFAULT_TIMEOUT @@wait_event = new_config[:wait_event] || DEFAULT_WAIT_EVENT @@debug = new_config[:debug].nil? ? false : new_config[:debug] raise ArgumentError, "GhostInThePost.config.phantomjs_path is not set" if self.phantomjs_path.nil? end def self.phantomjs_path @@phantomjs_path or raise ArgumentError, "GhostInThePost.config.phantomjs_path is not set" end private def self.complain_about_unknown_keys(keys) invalid_keys = keys - ATTRIBUTE_NAMES if invalid_keys.size > 0 raise ArgumentError, "Unknown configuration parameters: #{invalid_keys}", caller(1) end end end require "ghost_in_the_post/version" require "ghost_in_the_post/js_inline" require "ghost_in_the_post/phantom_transform" require "ghost_in_the_post/mail_ghost" require "ghost_in_the_post/ghost_on_command" require "ghost_in_the_post/ghost_on_delivery" require "ghost_in_the_post/mailer" require "ghost_in_the_post/automatic"
Version data entries
6 entries across 6 versions & 1 rubygems