From 12b30b7e861c510593c6a8bd4bae68c2126106db Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 26 Jun 2012 18:56:43 +0200 Subject: moved user and log class to models, verify prints logs --- example/models/log.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 example/models/log.rb (limited to 'example/models/log.rb') 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 -- cgit v1.2.3