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.



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

Returns:

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

#deleteObject



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

def delete
  File.delete(@path)
end

#getObject



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