How to pass values for Ruby method with *args and &block?
<p>The method <code>aasm</code> is defined as:</p>

<pre><code>def aasm(*args, &amp;block)
  if args[0].is_a?(Symbol) || args[0].is_a?(String)
    # using custom name
    state_machine_name = args[0].to_sym
    options = args[1] || {}
  else
    # using the default state_machine_name
    state_machine_name = :default
    options = args[0] || {}
  end
  .......
  #do something else
end
</code></pre>

<p>Now we need to put the whole <code>aasm....</code> in a string and do <code>eval</code> on it:</p>

<pre><code>  eval("aasm(:test) :column =&gt; 'col_name' {#{def_string}}")

  def_string = "state :fresh, :initial =&gt; true
                state :move
                event :submit do
                  transitions :from =&gt; :fresh, :to =&gt; :move
                end"     
</code></pre>

<p>But there is syntax error of <code>unexpected ':', expecting end-of-input</code>. We tried to put <code>(:test) :column =&gt; 'col_name'</code> in <code>{}</code> and <code>[]</code> and the error is not disappearing. What's the right way to pass all values to <code>aasm</code> in one line?</p>