Module: CrossingGuard

Defined in:
lib/crossing_guard.rb,
lib/crossing_guard/version.rb

Defined Under Namespace

Classes: Version

Class Method Summary collapse

Class Method Details

.awakenObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/crossing_guard.rb', line 15

def self.awaken
  filename  = config[:ops]
  file_safe = filename+'.op'

  File.rename(filename, file_safe)
  IO.readlines(file_safe).uniq.each do |d|
    `#{d}`
  end
  File.delete(file_safe)
end

.configObject



5
6
7
# File 'lib/crossing_guard.rb', line 5

def self.config
  @config ||= Config.config
end

.sleep(command) ⇒ Object



9
10
11
12
13
# File 'lib/crossing_guard.rb', line 9

def self.sleep(command)
  ops_file = File.open(config[:ops], 'a+') do |f|
    f.write "#{command}\n"
  end
end