class Numo::NArray

Public Instance Methods

to_html() click to toggle source
# File lib/rubydown.rb, line 12
def to_html
  case ndim
  when 2
    rows = self.to_a.map do |row|
      elems = row.map do |elem|
        "<td>#{elem}</td>"
      end
      "<tr>#{elems.join}</tr>"
    end
    "<table>#{rows.join}</table>"
  when 1
    cols = self.to_a.map do |elem|
      "<td>#{elem}</td>"
    end
    "<table><tr>#{cols.join}</tr></table>"
  else
    inspect
  end
end