Permalink
Browse files

Merge pull request #151 from JuliaGizmos/jbj/option-pairs

Allow pairs as options
  • Loading branch information...
2 parents 4556606 + 7af219f commit 738d42d398534ebd1630a380fd4ad969080b1732 @shashi shashi committed on GitHub Dec 28, 2016
Showing with 16 additions and 1 deletion.
  1. +1 −1 src/widgets.jl
  2. +15 −0 test/notebooks/Interact Manual Tests.ipynb
View
@@ -365,7 +365,7 @@ function getoptions(options)
optdict = OptionDict(opts)
end
-addoption!(opts, v::NTuple{2}) = opts[string(v[1])] = v[2]
+addoption!(opts, v::Union{Pair, NTuple{2}}) = opts[string(v[1])] = v[2]
addoption!(opts, v) = opts[string(v)] = v
"""
@@ -483,6 +483,21 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "#Demo on README, was broken because option Pairs didn't work\n",
+ "using Gadfly\n",
+ "@manipulate for Φ=0:π/16:4π, f=[:sin => sin, :cos => cos]\n",
+ " plot(θ -> f(θ+Φ ), 0, 25)\n",
+ "end"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
"collapsed": false
},
"outputs": [],

0 comments on commit 738d42d

Please sign in to comment.