Class: ActiveWarehouse::Builder::BigDecimalGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/active_warehouse/builder/random_data_builder.rb

Overview

Basic BigDecimal generator

Instance Method Summary collapse

Instance Method Details

#generate(column, options = {}) ⇒ Object

Generate a big decimal from 0 to options inclusive (default 1000)

Options:

  • :max: The maximum allowed value (default 1000)



179
180
181
182
# File 'lib/active_warehouse/builder/random_data_builder.rb', line 179

def generate(column, options={})
  options[:max] ||= 1000
  BigDecimal.new((rand * options[:max].to_f).to_s) # TODO: need BigDecimal type?
end