diff options
| author | Luke Kanies <luke@madstop.com> | 2005-04-14 16:18:12 +0000 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2005-04-14 16:18:12 +0000 |
| commit | d8e8b7bac463353728f703a73ae98deedc3fc146 (patch) | |
| tree | c842371f1e743945c10f39cef68c9e66da22a268 | |
| parent | c0c1f1a2c4b93abfe410c308d6787eeef0276348 (diff) | |
| download | puppet-d8e8b7bac463353728f703a73ae98deedc3fc146.tar.gz puppet-d8e8b7bac463353728f703a73ae98deedc3fc146.tar.xz puppet-d8e8b7bac463353728f703a73ae98deedc3fc146.zip | |
renaming state, and adding modification class
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@157 980ebf18-57e1-0310-9a29-db15c13687c0
| -rw-r--r-- | lib/blink.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/blink.rb b/lib/blink.rb index f5d13f87a..433e7d896 100644 --- a/lib/blink.rb +++ b/lib/blink.rb @@ -145,7 +145,7 @@ module Blink # a class for storing state # not currently used - class State + class Storage include Singleton @@config = "/var/tmp/blinkstate" @@state = Hash.new @@ -155,7 +155,7 @@ module Blink self.load end - def State.load + def Storage.load puts "loading state" return unless File.exists?(@@config) File.open(@@config) { |file| @@ -171,14 +171,14 @@ module Blink } end - def State.state(myclass) + def Storage.state(myclass) unless defined? @@state[myclass] @@state[myclass] = Hash.new end return @@state[myclass] end - def State.store + def Storage.store File.open(@@config, File::CREAT|File::WRONLY, 0644) { |file| @@state.each { |key, value| file.puts([self.class,key,value].join(@@splitchar)) @@ -244,4 +244,17 @@ module Blink end end #------------------------------------------------------------ + + #------------------------------------------------------------ + class Modification + attr_accessor :object, :type, :from, :to + + def initialize(object) + @object = object + @type = object.class + @from = object.is? + @to = object.should? + end + end + #------------------------------------------------------------ end |
