Sha256: e5fef56030904412a412c367370c826acd34db3b82e80fc3e06e63616d7633ba

Contents?: true

Size: 459 Bytes

Versions: 2

Compression:

Stored size: 459 Bytes

Contents

module EasyAsPie
  module ViewHelper

    # <div class="chart" data-percent="73">73%</div>
    def easy_pie_chart percent, *args
      raise ArgumentError, "Must take a percent argument" unless percent
      pie_options = {:"data-percent" => percent, :class => 'chart'}
      
      options = args.extract_options!
      pie_options.merge!(options || {})

      label = args.first || "#{percent}%"

      content_tag :div, label, pie_options
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
easy_pie_chart-0.1.2 lib/easy_pie_chart/view_helper.rb
easy_pie_chart-0.1.1 lib/easy_pie_chart/view_helper.rb