Class: Faker::Commerce

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/commerce.rb

Constant Summary

Constants inherited from Base

Base::Letters, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, fetch, flexible, letterify, method_missing, numerify, parse, regexify, translate

Class Method Details

.colorObject



5
6
7
# File 'lib/faker/commerce.rb', line 5

def color
  fetch('commerce.color')
end

.departmentObject



9
10
11
# File 'lib/faker/commerce.rb', line 9

def department
  fetch('commerce.department')
end

.priceObject



17
18
19
20
# File 'lib/faker/commerce.rb', line 17

def price
  random = Random.new
  (random.rand(0..100.0) * 100).floor/100.0
end

.product_nameObject



13
14
15
# File 'lib/faker/commerce.rb', line 13

def product_name
  fetch('commerce.product_name.adjective') + ' ' + fetch('commerce.product_name.material') + ' ' + fetch('commerce.product_name.product')
end