tagid

tagid(tag)
Instance Public methods

def #set_spans(*pairs)

if pairs[0].kind_of?(Array)
  # [idx, val], [idx, val], ...
  args = []
  pairs.each{|idx, val|
    args << tagid(idx)
    if val.kind_of?(Array)
      args << val.join(',')
    else
      args << val
    end
  }
  tk_send('spans', *args)
else
  # idx, val, idx, val, ...
  args = []
  0.step(pairs.size-1, 2){|i|
    args << tagid(pairs[i])
    val = pairs[i+1]
    if val.kind_of?(Array)
      args << val.join(',')
    else
      args << val
    end
  }
  tk_send('spans', *args)
end
self

end

doc_ruby_on_rails
2015-06-01 07:07:50
Comments
Leave a Comment

Please login to continue.