Sha256: 50fa5ed7dd5c0ac363afa22b93d3e2cbfd5dc4b95459aa3a363936f968255838
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
module MediaControl class << self attr_accessor :root # Configuration options # * log: Enable message logging using ActiveRecord's logger if available or 'puts' if not. Defaults to true. def options @options ||= { :log => true } end def configure yield(self) if block_given? end # Log a message if logging is enabled in options def log message logger "[media_control] #{message}" if logging? end def logger message #:nodoc: puts message end def logging? #:nodoc: options[:log] end end end # Use Railties if we're using Rails if defined?(Rails) module MediaControl class Railtie < Rails::Railtie initializer "media_control.set_paths" do MediaControl.root = Rails.root.join(Rails.public_path).to_s end end # Since we're using Rails, use ActiveRecord's logger so it honors log levels, etc def logger message #:nodoc: ActiveRecord::Base.logger.info message end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
media_control-0.0.2 | lib/media_control.rb |