Ruboty::ToggleSwitch

Build Status

ruboty-toggle_switch allows you to toggle switch on/off.

Installation

Add this line to your application's Gemfile:

gem 'ruboty-toggle_switch'

Usage

> ruboty toggle radio switch on
radio switch is now on.
> ruboty show radio switch status
radio switch is on.
> ruboty toggle radio switch off
radio switch is now off.
> ruboty show radio switch status
radio switch is off.

API

Use Ruboty::ToggleSwitch::Storage to get the state of switch from another handlers:

storage = Ruboty::ToggleSwitch::Storage.new(robot.brain)
record  = storage['switch']
record.status # => 'on' or 'off'