]> git.cworth.org Git - sup/blobdiff - lib/sup/horizontal-selector.rb
Add new :crypto_default configuration option.
[sup] / lib / sup / horizontal-selector.rb
index aef16d4844e2379d65c910332e4317eb758add19..13c63ed38e17b4a5a91957aadd7417c89480abc1 100644 (file)
@@ -12,7 +12,13 @@ class HorizontalSelector
     @selection = 0
   end
 
-  def set_to val; @selection = @vals.index(val) end
+  def set_to val
+    if @vals.index(val)
+      @selection = @vals.index(val)
+    else
+      error "Invalid option ", val.inspect, " (valid options: ", @vals.inspect, ")"
+    end
+  end
 
   def val; @vals[@selection] end