Class: Lims::Core::Persistence::Logger::Session

Inherits:
Session show all
Defined in:
lib/lims-core/persistence/logger/session.rb

Overview

Logger specific implementation of a Session.

Instance Attribute Summary collapse

Attributes inherited from Session

#dirty_attribute_strategy

Instance Method Summary collapse

Methods inherited from Session

#<<, #delete, #dirty_key_for, #filter, find_or_create_persistor_for, #id_for, #id_for!, #manage_state, #managed?, #method_missing, model_for, model_map, model_to_name, name_to_model, pack_uuid, #pack_uuid, persistor_class_for, persistor_class_map, #persistor_for, persistor_name_for, #persistor_name_for, register_model, #save_all, #serialize, #state_for, #states_for, #transaction, #unpack_uuid, unpack_uuid, #unserialize, #with_session, #with_subsession

Constructor Details

#initialize(*args, &block) ⇒ Session

Returns a new instance of Session.



13
14
15
16
# File 'lib/lims-core/persistence/logger/session.rb', line 13

def initialize(*args, &block)
  @indent_level = ""
  super(*args, &block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Lims::Core::Persistence::Session

Instance Attribute Details

#indent_levelObject (readonly)

Returns the value of attribute indent_level.



12
13
14
# File 'lib/lims-core/persistence/logger/session.rb', line 12

def indent_level
  @indent_level
end

Instance Method Details

#log(msg) ⇒ Object



18
19
20
# File 'lib/lims-core/persistence/logger/session.rb', line 18

def log(msg)
  @store.log(indent_level+msg)
end

#with_indent(indent = " - ", &block) ⇒ Object

Execute a block with the specified indent level indicator.

Parameters:

  • indent (String) (defaults to: " - ")

    the indent level indicator



24
25
26
# File 'lib/lims-core/persistence/logger/session.rb', line 24

def with_indent(indent=" - ", &block)
  temporarily('@indent_level' => @indent_level+indent, &block)
end