diff options
author | Azul <azul@leap.se> | 2012-06-26 18:56:43 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-06-26 18:56:43 +0200 |
commit | 12b30b7e861c510593c6a8bd4bae68c2126106db (patch) | |
tree | 4c578c34958f020dd0cddc3df3ac1e0f87b776d6 /example/models/log.rb | |
parent | f32497f143ef95264706dba27ce3e7a26d7ba6a4 (diff) |
moved user and log class to models, verify prints logs
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 |