mirror of
https://github.com/askn/faker.git
synced 2023-08-10 21:13:01 +03:00
add password and price
This commit is contained in:
parent
bbd1a10a42
commit
d0044abb6d
@ -50,6 +50,7 @@ Faker::Address.longitude
|
|||||||
Faker::Commerce.color
|
Faker::Commerce.color
|
||||||
Faker::Commerce.department
|
Faker::Commerce.department
|
||||||
Faker::Commerce.product_name
|
Faker::Commerce.product_name
|
||||||
|
Faker::Commerce.price
|
||||||
```
|
```
|
||||||
|
|
||||||
### Faker::Company
|
### Faker::Company
|
||||||
|
@ -25,6 +25,7 @@ puts "\n### Faker::Commerce\n\n"
|
|||||||
puts Faker::Commerce.color
|
puts Faker::Commerce.color
|
||||||
puts Faker::Commerce.department
|
puts Faker::Commerce.department
|
||||||
puts Faker::Commerce.product_name
|
puts Faker::Commerce.product_name
|
||||||
|
puts Faker::Commerce.price
|
||||||
|
|
||||||
puts "\n### Faker::Company\n\n"
|
puts "\n### Faker::Company\n\n"
|
||||||
|
|
||||||
@ -46,6 +47,9 @@ puts Faker::Internet.user_name
|
|||||||
puts Faker::Internet.user_name("Nancy")
|
puts Faker::Internet.user_name("Nancy")
|
||||||
puts Faker::Internet.user_name("Nancy Johnson", %w(. _ -))
|
puts Faker::Internet.user_name("Nancy Johnson", %w(. _ -))
|
||||||
|
|
||||||
|
puts Faker::Internet.password
|
||||||
|
puts Faker::Internet.password(12)
|
||||||
|
|
||||||
puts Faker::Internet.domain_name
|
puts Faker::Internet.domain_name
|
||||||
puts Faker::Internet.domain_word
|
puts Faker::Internet.domain_word
|
||||||
puts Faker::Internet.domain_suffix
|
puts Faker::Internet.domain_suffix
|
||||||
|
@ -12,5 +12,9 @@ module Faker
|
|||||||
product_name = Data["commerce"]["product_name"] as Hash
|
product_name = Data["commerce"]["product_name"] as Hash
|
||||||
Faker.fetch(product_name["adjective"]) + " " + Faker.fetch(product_name["material"]) + " " + Faker.fetch(product_name["product"])
|
Faker.fetch(product_name["adjective"]) + " " + Faker.fetch(product_name["material"]) + " " + Faker.fetch(product_name["product"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.price
|
||||||
|
(rand(100) + rand).round(2)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -53,5 +53,13 @@ module Faker
|
|||||||
glue ||= %w(- _ .).sample
|
glue ||= %w(- _ .).sample
|
||||||
(words || Lorem.words(2).join(' ')).gsub(' ', glue).downcase
|
(words || Lorem.words(2).join(' ')).gsub(' ', glue).downcase
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.password(min_length = 0)
|
||||||
|
temp = Lorem.words.join
|
||||||
|
while temp.size < min_length
|
||||||
|
temp += Lorem.word
|
||||||
|
end
|
||||||
|
return temp
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -6,6 +6,11 @@ module Faker
|
|||||||
Array(String).new(char_count < 0 ? 0 : char_count, "").map { chars.sample }.join("")
|
Array(String).new(char_count < 0 ? 0 : char_count, "").map { chars.sample }.join("")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.word
|
||||||
|
words = Data["lorem"]["words"] as Array
|
||||||
|
Faker.fetch(words)
|
||||||
|
end
|
||||||
|
|
||||||
def self.words(num = 3, supplemental = false)
|
def self.words(num = 3, supplemental = false)
|
||||||
words = Data["lorem"]["words"] as Array
|
words = Data["lorem"]["words"] as Array
|
||||||
words += (Data["lorem"]["supplemental"] as Array) if supplemental
|
words += (Data["lorem"]["supplemental"] as Array) if supplemental
|
||||||
|
Loading…
Reference in New Issue
Block a user