Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

Commit

Permalink
change regex syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
interstateone committed Nov 24, 2012
1 parent a8f7ec4 commit 34be072
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/siriproxy-hue.rb
Expand Up @@ -79,7 +79,7 @@ def is_numeric?(obj)
end

# Binary state
listen_for /turn (on|off)(?: the)? ([a-z]*)/i do |state, entity|
listen_for %r/turn (on|off)(?: the)? ([a-z]*)/i do |state, entity|
unless(matchedEntity = HueEntity.new(entity))
say "I couldn't find any lights by that name."
request_completed
Expand All @@ -102,7 +102,7 @@ def is_numeric?(obj)
end

# Relative brightness change
listen_for /turn (up|down)(?: the)? ([a-z]*)/i do |change, entity|
listen_for %r/turn (up|down)(?: the)? ([a-z]*)/i do |change, entity|
unless(matchedEntity = HueEntity.new(entity))
say "I couldn't find any lights by that name."
request_completed
Expand Down Expand Up @@ -132,8 +132,8 @@ def is_numeric?(obj)

# Absolute brightness/color change
# Numbers (0-254) and percentages (0-100) are treated as brightness values
# Strings are used as a color query to lookup HSV values
listen_for /set(?: the)? ([a-z]*) to ([a-z0-9%]*)/i do |entity, value|
# Single words are used as a color query to lookup HSV values
listen_for %r/set(?: the)? ([a-z]*) to ([a-z0-9%]*)/i do |entity, value|
unless(matchedEntity = HueEntity.new(entity))
say "I couldn't find any lights by that name."
request_completed
Expand All @@ -155,9 +155,7 @@ def is_numeric?(obj)
end

# Scenes
listen_for /make it look like a (.+)/i do |scene|
# do a google image request
# use the first result
listen_for %r/make it look like a (.+)/i do |scene|
# pull n colors, where n is the number of lights
# set each light to color[i]
request_completed
Expand Down

0 comments on commit 34be072

Please sign in to comment.