Class: Apicraft::Mocker::Number

Inherits:
Base
  • Object
show all
Defined in:
lib/apicraft/mocker/number.rb

Overview

Generate fake values for numbers

Direct Known Subclasses

Integer

Instance Attribute Summary

Attributes inherited from Base

#schema

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Apicraft::Mocker::Base

Instance Method Details

#mockObject



7
8
9
10
11
12
13
14
# File 'lib/apicraft/mocker/number.rb', line 7

def mock
  return enum.sample if enum.present?

  Faker::Number.between(
    from: schema.minimum || 1,
    to: schema.maximum || 100
  ) * multiple_of
end