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.
25 26 27 |
# File 'lib/terrafying/state.rb', line 25 def initialize(path) @path = LocalStateStore.state_path(path) end |
Class Method Details
.has_local_state?(config) ⇒ Boolean
41 42 43 |
# File 'lib/terrafying/state.rb', line 41 def self.has_local_state?(config) File.exists?(state_path(config.path)) end |
Instance Method Details
#delete ⇒ Object
37 38 39 |
# File 'lib/terrafying/state.rb', line 37 def delete File.delete(@path) end |
#get ⇒ Object
29 30 31 |
# File 'lib/terrafying/state.rb', line 29 def get IO.read(@path) end |
#put(state) ⇒ Object
33 34 35 |
# File 'lib/terrafying/state.rb', line 33 def put(state) IO.write(@path, state) end |