Module: EasyAsPie::ViewHelper

Defined in:
lib/easy_as_pie/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#easy_as_pie(percent, label = nil) ⇒ Object

<div class=“chart” data-percent=“73”>73%</div>

Raises:

  • (ArgumentError)


5
6
7
8
9
10
# File 'lib/easy_as_pie/view_helper.rb', line 5

def easy_as_pie percent, label = nil
  raise ArgumentError, "Must take a percent argument" unless percent
  pie_options = {:"data-percent" => percent}
  label ||= "#{percent}%"
   :div, label, pie_options
end