Sha256: 4b46f059ece759e69a4528f943395d35ebd634a38de18be5d6b4d8ef175e9312

Contents?: true

Size: 456 Bytes

Versions: 1

Compression:

Stored size: 456 Bytes

Contents

module EasyAsPie
  module ViewHelper

    # <div class="chart" data-percent="73">73%</div>
    def easy_as_pie 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

1 entries across 1 versions & 1 rubygems

Version Path
easy_as_pie-0.1.2 lib/easy_as_pie/view_helper.rb