Class: Terrafying::State::LocalStateStore

Inherits:
Object
  • Object
show all
Defined in:
lib/terrafying/state.rb

Class Method Summary collapse

Instance Method Summary collapse

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

Returns:

  • (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

#deleteObject



37
38
39
# File 'lib/terrafying/state.rb', line 37

def delete
  File.delete(@path)
end

#getObject



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