Sha256: b6b4b56cd4d730ea2ca1f398a0041719718dd8e0ba606b99cd4458fed2529735

Contents?: true

Size: 292 Bytes

Versions: 5

Compression:

Stored size: 292 Bytes

Contents

module Percentable
  module Percentize
    def percentize *args
      options = args.pop if args.last.is_a? Hash

      args.each do |method_name|
        define_method(method_name) do |args=[]|
          Percent.new(super(*args) || options[:default])
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
percentable-1.1.2 lib/percentable/percentize.rb
percentable-1.0.2 lib/percentable/percentize.rb
percentable-1.0.1 lib/percentable/percentize.rb
percentable-1.0.0 lib/percentable/percentize.rb
percentable-0.1.0 lib/percentable/percentize.rb