module HydroponicBean::Commands::Tube

Public Instance Methods

kick(stream, bound) click to toggle source
# File lib/hydroponic_bean/commands/tube.rb, line 39
def kick(stream, bound)
  HydroponicBean.update_time!
  bound = bound.to_i
  tube = current_tube
  output("KICKED #{tube.kick(bound)}\r\n")
end
list_tubes(stream) click to toggle source
# File lib/hydroponic_bean/commands/tube.rb, line 4
def list_tubes(stream)
  tubes = HydroponicBean.tubes.keys.to_yaml
  output("OK #{tubes.length}\r\n")
  output("#{tubes}\r\n")
end
list_tubes_watched(stream) click to toggle source
# File lib/hydroponic_bean/commands/tube.rb, line 10
def list_tubes_watched(stream)
  tubes = watched_tube_names.to_yaml
  output("OK #{tubes.length}\r\n")
  output("#{tubes}\r\n")
end
pause_tube(stream, tube_name, delay) click to toggle source
# File lib/hydroponic_bean/commands/tube.rb, line 28
def pause_tube(stream, tube_name, delay)
  if HydroponicBean.tubes.has_key?(tube_name)
    tube = HydroponicBean.tubes[tube_name]
    tube.pause(delay)
    output("PAUSED\r\n")
  else
    output(Protocol::NOT_FOUND)
    return false
  end
end
stats_tube(stream, tube_name) click to toggle source
# File lib/hydroponic_bean/commands/tube.rb, line 16
def stats_tube(stream, tube_name)
  if HydroponicBean.tubes.has_key?(tube_name)
    tube = HydroponicBean.tubes[tube_name]
    data = tube.serialize_stats.to_yaml
    output("OK #{data.length}\r\n")
    output("#{data}\r\n")
  else
    output(Protocol::NOT_FOUND)
    return false
  end
end