ruboty-toggle_switch 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39d3ee221377e329ddf9578f97222c168bab7f92
4
- data.tar.gz: b8b2c9a16a71a38d5142181502715d7315f69254
3
+ metadata.gz: 9c1220d0e943d1deb267ee35a62f685ca718b3c1
4
+ data.tar.gz: 2cd9d3eb95a92c74fc6aa8bec36400d4ba55c06d
5
5
  SHA512:
6
- metadata.gz: 392a15c6dfbd2fdbc20f0691406471533483ceebcd7a31a6aa39fd357bb9525a39c4e3e51c3a36cc2810bb53e660291d97d4ade774c26ef95b46d2aaa7060229
7
- data.tar.gz: ea18e7c97c2be32bd12ccc4b56313349a7696b6b2eeafebd19031d07ddd2c453f190a0a3fb1658736de1477edddec271fad1574f0701a1d7f883557510e32cbc
6
+ metadata.gz: 7d8ba2502e9c6379b6a336a17ffc1fd67d8e15d3ff30492b0c92a0fbb27e6c4e9323f74003035aa3463101f3e5701d093c8e51f8eb18d05c0dfc9d18f66fb4fd
7
+ data.tar.gz: 331d5b7c38afb1eb351d2b68bb208e0cf3bb3dc2b0fe85eb8cab173f78548a66db780ac0a017bea3cad9629a2e0e51e51b4244b046951be4e4451dd73d1b9b64
data/README.md CHANGED
@@ -24,3 +24,13 @@ radio switch is now off.
24
24
  > ruboty show radio switch status
25
25
  radio switch is off.
26
26
  ```
27
+
28
+ ## API
29
+
30
+ Use `Ruboty::ToggleSwitch::Storage` to get the state of switch from another handlers:
31
+
32
+ ```ruby
33
+ storage = Ruboty::ToggleSwitch::Storage.new(robot.brain)
34
+ record = storage['switch']
35
+ record.status # => 'on' or 'off'
36
+ ```
@@ -3,8 +3,8 @@ module Ruboty
3
3
  class ToggleSwitch < Base
4
4
  NAMESPACE = 'toggle_switch'
5
5
 
6
- on(/toggle\s+(?<switch>.*)\s+(?<state>on|off)/, name: 'toggle', description: 'Toggle switch')
7
- on(/show\s+(?<switch>.*)\s+status/, name: 'show', description: 'Show switch status')
6
+ on(/toggle\s+(?<switch>.*)\s+(?<state>on|off)\z/, name: 'toggle', description: 'Toggle switch')
7
+ on(/show\s+(?<switch>.*)\s+status\z/, name: 'show', description: 'Show switch status')
8
8
 
9
9
  def toggle(message)
10
10
  switch = message[:switch]
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module ToggleSwitch
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-toggle_switch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naoto Takai