lib/shog/formatter.rb
# Use configuration defined in the given module.
#
# @param [Symobl,#configure] mod the name of the shog module to use or an
#   object that responds to `#configure`.
#
# @return [Formatter] self.
#
# When `mod` is a symobl, it loads one of the modules from
# {Shog::Formatters} and uses any configuration options sepcified in that
# module.
#
# Otherwise `mod` must respond to `#configure` taking a single argument -
# this formatter.
#
# @example Built-in Formatters
#   configure do
#     with :defaults
#     with :requests
#   end
#
# @example Custom Shared Formatters
#   module MyFormatters
#     def self.configure( formatter )
#       formatter.configure do
#         timestamp
#       end
#     end
#   end
#
#   configure do
#     with MyFormatters
#   end
Use configuration defined in the given module.
Use configuration defined in the given module .
def with( mod )
      unless mod.is_a? Module
        mod = "Shog::Formatters::#{mod.to_s.camelize}".constantize
      end
      mod.configure self
      self
    end
def with ( mod ) unless mod . is_a? Module mod = "Shog::Formatters::#{mod.to_s.camelize}" . constantize end mod . configure self self end
Use configuration defined in the given module.
Use configuration defined in the given module .
self. When `mod` is a symobl, it loads one of the modules from {Shog::Formatters} and uses any configuration options sepcified in that module. Otherwise `mod` must respond to `#configure` taking a single argument this formatter.
self . When ` mod ` is a symobl it loads one of the modules from { Shog :: Formatters } and uses any configuration options sepcified in that module . Otherwise ` mod ` must respond to ` #configure ` taking a single argument this formatter .
Formatter
mod
<not_specific>
<not_specific>
mod the name of the shog module to use or an object that responds to `#configure`.
mod the name of the shog module to use or an object that responds to ` #configure ` .
example
Built-in Formatters configure do with :defaults with :requests end
Built - in Formatters configure do with : defaults with : requests end
example
Custom Shared Formatters module MyFormatters def self.configure( formatter ) formatter.configure do timestamp end end end configure do with MyFormatters end
Custom Shared Formatters module MyFormatters def self . configure ( formatter ) formatter . configure do timestamp end end end configure do with MyFormatters end