可変数のユーザー入力フィールドから作成された文字列を使用して、Coffeeスクリプトのクラスインスタンスでメソッドを呼び出そうとしています。特定の図形を描画するためのメソッドを呼び出す必要がある「サーフェス」インスタンスがあるとします。CoffeeScriptのコードは次のとおりです。
dojo.ready ->
dojoConfig = gfxRenderer: "svg,silverlight,vml"
surface = dojox.gfx.createSurface("dojocan", 500, 400)
/ The user's input values are stored in an array
/ and then concatenated to create a string of this pattern:
/ formula = "createRect({pointX,pointY,height,width})"
/ Now I should apply the string "formula" as a method call to "surface" instance
surface."#{formula}".setStroke("red")
/ ?? as it would be in Ruby , but .... it fails
私はすべての同様の質問を見てきましたが、CoffeeScriptでそれを実装するための答えを見つけることができません。
お時間をいただきありがとうございます。