diff options
Diffstat (limited to 'example/models/log.rb')
-rw-r--r-- | example/models/log.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/example/models/log.rb b/example/models/log.rb new file mode 100644 index 0000000..9e700a8 --- /dev/null +++ b/example/models/log.rb @@ -0,0 +1,31 @@ +require 'yaml' + +class Log + + def self.current + @current ||= Log.new + end + + def self.log(*args) + self.current.log(*args) + end + + def self.clear + @current = nil + end + + attr_accessor :actions + + def initialize + @actions = [] + end + + def log(action, params) + @actions << {action => params.dup} + end + + def pretty + @actions.to_yaml + end + +end |