Class: Bake::Blocks::Sleep

Inherits:
Object
  • Object
show all
Defined in:
lib/blocks/sleep.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Sleep

Returns a new instance of Sleep.



6
7
8
9
# File 'lib/blocks/sleep.rb', line 6

def initialize(config)
  @echo = (config.echo != "off")
  @time = config.name.to_f
end

Instance Method Details

#cleanObject



33
34
35
36
# File 'lib/blocks/sleep.rb', line 33

def clean
  # nothing to do here
  return true
end

#cleanStepObject



29
30
31
# File 'lib/blocks/sleep.rb', line 29

def cleanStep
  return run()
end

#executeObject



17
18
19
# File 'lib/blocks/sleep.rb', line 17

def execute
  return run()
end

#exitStepObject



25
26
27
# File 'lib/blocks/sleep.rb', line 25

def exitStep
  return run()
end

#runObject



11
12
13
14
15
# File 'lib/blocks/sleep.rb', line 11

def run
  puts "Sleeping #{@time}s" if @echo
  sleep @time
  return true
end

#startupStepObject



21
22
23
# File 'lib/blocks/sleep.rb', line 21

def startupStep
  return run()
end