Class: Range

Inherits:
Object show all
Defined in:
lib/ext_core.rb

Overview

Some extentions to the core Range class

Instance Method Summary collapse

Instance Method Details

#generate(*_args) ⇒ Object

Randomly generate a value within the range



173
174
175
176
177
178
179
# File 'lib/ext_core.rb', line 173

def generate(*_args)
  if first.is_a? Numeric and last.is_a? Numeric
    Faker::Number.between(first, last)
  else
    to_a.sample
  end
end