Class: MavenLogger::Schema

Inherits:
Object
  • Object
show all
Defined in:
lib/maven_logger/schema.rb

Direct Known Subclasses

LoggerSchema

Class Method Summary collapse

Class Method Details

.add_schema_for(klass, method, handler) ⇒ Object



13
14
15
16
17
18
# File 'lib/maven_logger/schema.rb', line 13

def self.add_schema_for(klass, method, handler)
  class_name = klass.name.underscore.to_sym
  schema[class_name] = {} unless schema[class_name]

  schema[class_name][method] = handler
end

.prepare(entry) ⇒ Object



6
7
8
9
10
11
# File 'lib/maven_logger/schema.rb', line 6

def self.prepare(entry)
  class_name = entry.object_type.underscore.to_sym
  method_name = entry.action_type.to_sym

  send(schema[class_name][method_name], entry.result) if schema[class_name] && schema[class_name][method_name]
end