Sha256: 0d4809bdae14f0ad7dbaf4eb95b263ac366ed7c96db985c58addc27564d07ea4
Contents?: true
Size: 1012 Bytes
Versions: 1
Compression:
Stored size: 1012 Bytes
Contents
module MediaControl class << self # 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.0 | lib/media_control.rb |