Sha256: b1cb7af16955a13dfbb0d16ad1baadef717434c38b6821c7611600723a2ae342

Contents?: true

Size: 319 Bytes

Versions: 16

Compression:

Stored size: 319 Bytes

Contents

class Forgery::Monetary < 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

16 entries across 16 versions & 1 rubygems

Version Path
forgery-0.4.2 lib/forgery/forgery/monetary.rb
forgery-0.4.1 lib/forgery/forgery/monetary.rb
forgery-0.4.0 lib/forgery/forgery/monetary.rb
forgery-0.3.12 lib/forgery/forgery/monetary.rb
forgery-0.3.11 lib/forgery/forgery/monetary.rb
forgery-0.3.10 lib/forgery/forgery/monetary.rb
forgery-0.3.9 lib/forgery/forgery/monetary.rb
forgery-0.3.8 lib/forgery/forgery/monetary.rb
forgery-0.3.7 lib/forgery/forgery/monetary.rb
forgery-0.3.6 lib/forgery/forgery/monetary.rb
forgery-0.3.5 lib/forgery/forgery/monetary.rb
forgery-0.3.4 lib/forgery/forgery/monetary.rb
forgery-0.3.3 lib/forgery/forgery/monetary.rb
forgery-0.3.2 lib/forgery/forgery/monetary.rb
forgery-0.3.1 lib/forgery/forgery/monetary.rb
forgery-0.3.0 lib/forgery/forgery/monetary.rb