module LogBook
Constants
- OPERATIONS
- VERSION
Public Class Methods
event(historian, historizable, differences, tag_list)
click to toggle source
# File lib/log_book.rb, line 17 def self.event(historian, historizable, differences, tag_list) return if @@muted tag_list_composed = [] tag_list_composed << scope_tag(historian) if historian tag_list_composed << kind_tag(historizable) if historizable tag_list_composed += [tag_list].flatten if tag_list LogBook::Event.create!( :historian => historian, :historizable => historizable, :differences => differences, :tag_list => tag_list_composed ) end
muted()
click to toggle source
# File lib/log_book.rb, line 37 def self.muted @@muted end
muted=(value)
click to toggle source
# File lib/log_book.rb, line 33 def self.muted=(value) @@muted = value end
Private Class Methods
created(historian, historizable)
click to toggle source
# File lib/log_book.rb, line 43 def self.created(historian, historizable) LogBook.event(historian, historizable, nil, LogBook::OPERATIONS[:create]) end
destroyed(historian, historizable)
click to toggle source
# File lib/log_book.rb, line 51 def self.destroyed(historian, historizable) LogBook.event(historian, historizable, nil, LogBook::OPERATIONS[:destroy]) end
kind_tag(historizable)
click to toggle source
# File lib/log_book.rb, line 59 def self.kind_tag(historizable) historizable.class.name.underscore end
scope_tag(historian)
click to toggle source
# File lib/log_book.rb, line 55 def self.scope_tag(historian) historian.class.name.underscore end
updated(historian, historizable)
click to toggle source
# File lib/log_book.rb, line 47 def self.updated(historian, historizable) LogBook.event(historian, historizable, LogBook::Utils.pretty_changes(historizable), LogBook::OPERATIONS[:update]) end