Class: Terrafying::State::LocalStateStore
- Inherits:
-
Object
- Object
- Terrafying::State::LocalStateStore
- Defined in:
- lib/terrafying/state.rb
Class Method Summary collapse
Instance Method Summary collapse
- #delete ⇒ Object
- #get ⇒ Object
-
#initialize(path) ⇒ LocalStateStore
constructor
A new instance of LocalStateStore.
- #put(state) ⇒ Object
Constructor Details
#initialize(path) ⇒ LocalStateStore
Returns a new instance of LocalStateStore.
26 27 28 |
# File 'lib/terrafying/state.rb', line 26 def initialize(path) @path = LocalStateStore.state_path(path) end |
Class Method Details
.has_local_state?(config) ⇒ Boolean
42 43 44 |
# File 'lib/terrafying/state.rb', line 42 def self.has_local_state?(config) File.exist?(state_path(config.path)) end |
Instance Method Details
#delete ⇒ Object
38 39 40 |
# File 'lib/terrafying/state.rb', line 38 def delete File.delete(@path) end |
#get ⇒ Object
30 31 32 |
# File 'lib/terrafying/state.rb', line 30 def get IO.read(@path) end |
#put(state) ⇒ Object
34 35 36 |
# File 'lib/terrafying/state.rb', line 34 def put(state) IO.write(@path, state) end |