Class: Consumer::Controls::PositionStore::LocalFile

Inherits:
Object
  • Object
show all
Includes:
PositionStore
Defined in:
lib/consumer/controls/position_store/local_file.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.buildObject



7
8
9
10
11
# File 'lib/consumer/controls/position_store/local_file.rb', line 7

def self.build
  instance = new
  instance.configure
  instance
end

Instance Method Details

#getObject



13
14
15
16
17
# File 'lib/consumer/controls/position_store/local_file.rb', line 13

def get
  return 0 unless File.exist?(path)
  text = File.read(path)
  text.to_i
end

#pathObject



23
24
25
# File 'lib/consumer/controls/position_store/local_file.rb', line 23

def path
  'tmp/control_position_store'
end

#put(position) ⇒ Object



19
20
21
# File 'lib/consumer/controls/position_store/local_file.rb', line 19

def put(position)
  File.write(path, position)
end