Module: PhiAttrs

Defined in:
lib/phi_attrs.rb,
lib/phi_attrs/logger.rb,
lib/phi_attrs/railtie.rb,
lib/phi_attrs/version.rb,
lib/phi_attrs/configure.rb,
lib/phi_attrs/formatter.rb,
lib/phi_attrs/exceptions.rb,
lib/phi_attrs/phi_record.rb

Defined Under Namespace

Modules: Configure, Exceptions, PhiRecord Classes: Formatter, Logger, Railtie

Constant Summary collapse

VERSION =
'0.1.1'.freeze
Format =
"%s %5s: %s\n".freeze
PHI_ACCESS_LOG_TAG =
'PHI Access Log'.freeze
@@log_path =
nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (PhiAttrs)

    the object that the method was called on



25
26
27
# File 'lib/phi_attrs.rb', line 25

def self.configure
  yield self if block_given?
end

.log_pathObject



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

def self.log_path
  @@log_path
end

.log_path=(value) ⇒ Object



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

def self.log_path=(value)
  @@log_path = value
end

Instance Method Details

#phi_model(with: nil, except: nil) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/phi_attrs.rb', line 14

def phi_model(with: nil, except: nil)
  include PhiRecord
  logger = ActiveSupport::Logger.new(PhiAttrs.log_path)
  logger.formatter = Formatter.new
  file_logger = ActiveSupport::TaggedLogging.new(logger)

  PhiAttrs::Logger.logger = file_logger
end