Sha256: e40169f22dc22159d70035f66f6e27b2bc1070146243cd4273ee42265ff36725
Contents?: true
Size: 1000 Bytes
Versions: 3
Compression:
Stored size: 1000 Bytes
Contents
# encoding: UTF-8 module Spontaneous class State < Sequel::Model(:spontaneous_state) class << self alias_method :sequel_plugin, :plugin end @@instance = nil class << self def instance return @@instance if @@instance unless instance = self.first instance = State.create(:revision => 1, :published_revision => 0) end instance end # def with_cache(&block) # yield if @@instance # @@instance = self.instance # yield # ensure # @@instance = nil # end def working_revision instance.revision end def revision instance.revision end def published_revision if ENV.key?(Spontaneous::SPOT_REVISION_NUMBER) ENV[Spontaneous::SPOT_REVISION_NUMBER] else instance.published_revision end end def pending_revision instance.pending_revision end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spontaneous-0.2.0.alpha2 | lib/spontaneous/state.rb |
spontaneous-0.2.0.alpha1 | lib/spontaneous/state.rb |
spontaneous-0.1.0.alpha1 | lib/spontaneous/state.rb |