Module: MediaControl
- Defined in:
- lib/media_control.rb,
lib/media_control.rb
Defined Under Namespace
Classes: Railtie
Class Attribute Summary collapse
-
.root ⇒ Object
Returns the value of attribute root.
Class Method Summary collapse
- .configure {|_self| ... } ⇒ Object
-
.log(message) ⇒ Object
Log a message if logging is enabled in options.
-
.logger(message) ⇒ Object
:nodoc:.
-
.logging? ⇒ Boolean
:nodoc:.
-
.options ⇒ Object
Configuration options * log: Enable message logging using ActiveRecord’s logger if available or ‘puts’ if not.
Instance Method Summary collapse
-
#logger(message) ⇒ Object
Since we’re using Rails, use ActiveRecord’s logger so it honors log levels, etc.
Class Attribute Details
.root ⇒ Object
Returns the value of attribute root.
8 9 10 |
# File 'lib/media_control.rb', line 8 def root @root end |
Class Method Details
.configure {|_self| ... } ⇒ Object
17 18 19 |
# File 'lib/media_control.rb', line 17 def configure yield(self) if block_given? end |
.log(message) ⇒ Object
Log a message if logging is enabled in options
22 23 24 |
# File 'lib/media_control.rb', line 22 def log logger "[media_control] #{}" if logging? end |
.logger(message) ⇒ Object
:nodoc:
25 26 27 |
# File 'lib/media_control.rb', line 25 def logger #:nodoc: puts end |
.logging? ⇒ Boolean
:nodoc:
28 29 30 |
# File 'lib/media_control.rb', line 28 def logging? #:nodoc: [:log] end |
.options ⇒ Object
Configuration options
-
log: Enable message logging using ActiveRecord’s logger if available or ‘puts’ if not. Defaults to true.
11 12 13 14 15 |
# File 'lib/media_control.rb', line 11 def @options ||= { :log => true } end |
Instance Method Details
#logger(message) ⇒ Object
Since we’re using Rails, use ActiveRecord’s logger so it honors log levels, etc
44 45 46 |
# File 'lib/media_control.rb', line 44 def logger #:nodoc: ActiveRecord::Base.logger.info end |