* html_format - http://github.com/akicho8/html_format ** DESCRIPTION HTML conversion of various objects easily. Since it is not limited as a helper of Rails, it can be used singly and anywhere. ** INSTALL Install as a standalone gem #+BEGIN_SRC shell-script $ gem install html_format #+END_SRC Or install within application using Gemfile #+BEGIN_SRC shell-script $ bundle add html_format $ bundle install #+END_SRC ** EXAMPLES *** Using to_html is easiest #+BEGIN_SRC ruby #+BEGIN_SRC ruby # Array of Hash [ {id: 1, name: "alice", created_at: "2000-01-01"}, {id: 2, name: "bob", created_at: "2000-01-02"}, {id: 3, name: "carol", created_at: "2000-01-03"}, ].to_html # => "
idnamecreated_at
1alice2000-01-01
2bob2000-01-02
3carol2000-01-03
" # Hash {id: 1, name: "alice", created_at: "2000-01-01"}.to_html # => "
id1
namealice
created_at2000-01-01
" # Array of Array [ [1, "alice", "2000-01-01"], [2, "bob", "2000-01-02"], [3, "carol", "2000-01-03"], ].to_html # => "
1alice2000-01-01
2bob2000-01-02
3carol2000-01-03
" # Array [0, 1, 2, 3].to_html # => "
0123
" #+END_SRC *** The html_format method feels like simple_format #+BEGIN_SRC ruby html_format(1) # => "
1
" #+END_SRC ** How to check by visual inspection during development #+BEGIN_SRC sh cd test/dummy rails s open http://localhost:3000/ #+END_SRC ** When combined with Rails and bootstrap app/assets/stylesheets/application.css #+BEGIN_SRC css /* *= require html_format/control */ #+END_SRC