Module: Bishl::HTMLHelper

Defined in:
lib/html_helper.rb

Instance Method Summary collapse

Instance Method Details

#bishl_standings(opt = {}) ⇒ Object

opt => {:type => :small, :season => “2010”, :cs => “LLA”, :css =>

    {:table_class => "myTable", :odd_class => "myOdd",:even_class => "myEven"
}


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/html_helper.rb', line 8

def bishl_standings(opt={})
begin
  table_class =  ""
  odd_class = ""
  even_class = ""
  type = opt.has_key?(:type) ? opt[:type] : :large
  if opt.has_key?(:css)
    table_class = opt[:css][:table_class] if opt[:css].has_key?(:table_class)
    odd_class = opt[:css][:odd_class] if opt[:css].has_key?(:odd_class)
    even_class = opt[:css][:even_class] if opt[:css].has_key?(:even_class)
  end

  parser = Bishl::Parser.new
  data = parser.parse_standings(:season => opt[:season], :cs => opt[:cs])

  return no_data_fetch(table_class) if data.empty?

  self.send(type, data,table_class,odd_class,even_class)
  

end
rescue => e
  no_data_fetch(opt[:table_class])
end