class Jquery_Accordian
Public Class Methods
new(hashGroups)
click to toggle source
# File lib/jquery_accordian.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_accordian.rb, line 15 def render unless @template.nil? ERB.new(@template).result(binding) end end
save(file)
click to toggle source
# File lib/jquery_accordian.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_accordian.rb, line 29 def get_template() %{ <html lang='en'> <head> <meta charset='utf-8'> <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='accordion'> <% @hashGroups.each do |k,v| %> <h3> <%= k.to_s %> </h3> <div> <p> <%= v %> </p> </div> <% end %> </div> <script> $( '#accordion' ).accordion(); </script> </body> </html> } end