class Jquery_Tabs

Public Class Methods

new(hashGroups) click to toggle source
# File lib/jquery_tabs.rb, line 8
def initialize(hashGroups)
  @hashGroups = hashGroups
  @template = get_template
  @div = UUIDTools::UUID.random_create

end

Public Instance Methods

render() click to toggle source
# File lib/jquery_tabs.rb, line 15
def render
  unless @template.nil?
    ERB.new(@template).result(binding)
  end
end
save(file) click to toggle source
# File lib/jquery_tabs.rb, line 21
def save(file)
  File.open(file, "w+") do |f|
    f.write(render)
  end
end

Private Instance Methods

get_template() click to toggle source
# File lib/jquery_tabs.rb, line 29
def get_template()
  %{
    <html lang='en'>
    <head>
      <meta charset="utf-8">
      <title>compute test results</title>
      <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
      <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
      <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    </head>
    <body>
     
    <div id="<%= @div %>">
      <ul>
        <% @hashGroups.each do |k,v| %>
        <li><a href="#<%= k.gsub(' ','') %>"><span> <%= k %> </span></a></li>
        <% end %>
      </ul>
      <% @hashGroups.each do |k,v| %>
      <div id="<%= k.gsub(' ','') %>">
      <%= v %>
      </div>
      <% end %>
    </div>
     
    <script>
    $( "#<%= @div %>" ).tabs();
    </script>
     
    </body>
    </html>
}

end