Sha256: 5d22afb760eba6fe0578e7f5fe1cdf46a8fd99ee2e5ae5ccaf3bcf61124c1c38

Contents?: true

Size: 315 Bytes

Versions: 5

Compression:

Stored size: 315 Bytes

Contents

class MonetaryForgery < Forgery
  def self.formatted_money(options={})
    "$%1.2f" % money(options)
  end

  def self.money(options={})
    options = {:max => 10,
               :min => 0}.merge(options)

    value = ((options[:min] * 100)..(options[:max] * 100)).random
    "%1.2f" % (value.to_f / 100)
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
sevenwire-forgery-0.1.0 lib/forgeries/monetary_forgery.rb
sevenwire-forgery-0.2.0 lib/forgeries/monetary_forgery.rb
sevenwire-forgery-0.2.1 lib/forgeries/monetary_forgery.rb
sevenwire-forgery-0.2.2 lib/forgeries/monetary_forgery.rb
forgery-0.2.2 lib/forgeries/monetary_forgery.rb