spans

spans()
Instance Public methods

def set(*pairs) # idx, val, idx, val, ⦠OR [idx, val], [idx, val], â¦

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

end def #set_row(*pairs)

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

end def #set_col(*pairs)

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

end

span_list

doc_ruby_on_rails
2015-06-01 06:11:49
Comments
Leave a Comment

Please login to continue.