Module: Logging::Rails

Defined in:
lib/logging/rails/generators/install_generator.rb,
lib/logging/rails/railtie.rb,
lib/logging/rails/mixin.rb,
lib/logging/rails.rb

Defined Under Namespace

Modules: Generators, Mixin Classes: Railtie

Constant Summary collapse

LIBPATH =

:stopdoc:

::File.expand_path('../..', __FILE__) + ::File::SEPARATOR
PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject (readonly)

Returns the value of attribute configuration.



33
34
35
# File 'lib/logging/rails.rb', line 33

def configuration
  @configuration
end

Class Method Details

.configure(&block) ⇒ Object

Stores the given Logging configuration block for later evalution by the Railtie. This method is used in the ‘config/logging.rb’ configuration file.



29
30
31
# File 'lib/logging/rails.rb', line 29

def configure( &block )
  @configuration = block
end

.libpath(*args) ⇒ Object

Returns the lib path for Mr Bones. If any arguments are given, they will be joined to the end of the path using File.join.



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/logging/rails.rb', line 54

def libpath( *args )
  rv =  args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
  if block_given?
    begin
      $LOAD_PATH.unshift LIBPATH
      rv = yield
    ensure
      $LOAD_PATH.shift
    end
  end
  return rv
end

.path(*args) ⇒ Object

Returns the path for Mr Bones. If any arguments are given, they will be joined to the end of the path using File.join.



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/logging/rails.rb', line 38

def path( *args )
  rv = args.empty? ? PATH : ::File.join(PATH, args.flatten)
  if block_given?
    begin
      $LOAD_PATH.unshift PATH
      rv = yield
    ensure
      $LOAD_PATH.shift
    end
  end
  return rv
end

.versionObject

Returns the version string for the library.



21
22
23
# File 'lib/logging/rails.rb', line 21

def version
  @version ||= File.read(path('version.txt')).strip
end