mirror of
https://github.com/askn/faker.git
synced 2023-08-10 21:13:01 +03:00
add Hacker
This commit is contained in:
parent
ed6663e116
commit
ca166af7af
28
README.md
28
README.md
@ -223,6 +223,9 @@ Faker::Number.decimal(2) #=> "11.88"
|
|||||||
|
|
||||||
Faker::Number.decimal(2, 3) #=> "18.843"
|
Faker::Number.decimal(2, 3) #=> "18.843"
|
||||||
|
|
||||||
|
# Required parameter: digits
|
||||||
|
Faker::Number.hexadecimal(3) #=> "e74"
|
||||||
|
|
||||||
Faker::Number.between(1, 10) #=> 7
|
Faker::Number.between(1, 10) #=> 7
|
||||||
|
|
||||||
Faker::Number.positive #=> 235.59238499107653
|
Faker::Number.positive #=> 235.59238499107653
|
||||||
@ -242,6 +245,31 @@ Faker::PhoneNumber.phone_number #=> "397.693.1309"
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Faker::Hacker
|
||||||
|
---------------------
|
||||||
|
Are you having trouble writing tech-savvy dialogue for your latest screenplay?
|
||||||
|
Worry not! Hollywood-grade technical talk is ready to fill out any form where you need to look smart.
|
||||||
|
|
||||||
|
```crystal
|
||||||
|
# Full Phrase
|
||||||
|
Faker::Hacker.say_something_smart #=> "Try to compress the SQL interface, maybe it will program the back-end hard drive!"
|
||||||
|
|
||||||
|
# Short technical abbreviations
|
||||||
|
Faker::Hacker.abbreviation #=> "RAM"
|
||||||
|
|
||||||
|
# Hacker centric adjectives
|
||||||
|
Faker::Hacker.adjective #=> "open-source"
|
||||||
|
|
||||||
|
# Only the best hacker related nouns
|
||||||
|
Faker::Hacker.noun #=> "bandwidth"
|
||||||
|
|
||||||
|
# Actions that hackers take
|
||||||
|
Faker::Hacker.verb #=> "bypass"
|
||||||
|
|
||||||
|
# Verbs that end in -ing
|
||||||
|
Faker::Hacker.ingverb #=> "synthesizing"
|
||||||
|
```
|
||||||
|
|
||||||
### Faker::Team
|
### Faker::Team
|
||||||
|
|
||||||
```crystal
|
```crystal
|
||||||
|
32
spec/hacker_spec.cr
Normal file
32
spec/hacker_spec.cr
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
require "./spec_helper"
|
||||||
|
|
||||||
|
describe Faker::Hacker do
|
||||||
|
assert { (Faker::Hacker.phrases.size == 8).should be_true }
|
||||||
|
|
||||||
|
it "phrases" do
|
||||||
|
Faker::Hacker.phrases.each do |phrase|
|
||||||
|
phrase.nil?.should be_false
|
||||||
|
(phrase == "").should be_false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it "noun" do
|
||||||
|
Faker::Hacker.noun.match(/\w+/).should_not eq nil
|
||||||
|
end
|
||||||
|
|
||||||
|
it "abbreviation" do
|
||||||
|
Faker::Hacker.abbreviation.match(/\w+/).should_not eq nil
|
||||||
|
end
|
||||||
|
|
||||||
|
it "adjective" do
|
||||||
|
Faker::Hacker.adjective.match(/\w+/).should_not eq nil
|
||||||
|
end
|
||||||
|
|
||||||
|
it "verb" do
|
||||||
|
Faker::Hacker.verb.match(/\w+/).should_not eq nil
|
||||||
|
end
|
||||||
|
|
||||||
|
it "ingverb" do
|
||||||
|
Faker::Hacker.ingverb.match(/\w+/).should_not eq nil
|
||||||
|
end
|
||||||
|
end
|
26
src/faker/hacker.cr
Normal file
26
src/faker/hacker.cr
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Port of http://shinytoylabs.com/jargon/
|
||||||
|
module Faker
|
||||||
|
class Hacker
|
||||||
|
def self.say_something_smart
|
||||||
|
phrases.sample
|
||||||
|
end
|
||||||
|
|
||||||
|
{% for data_type in %w(abbreviation adjective noun verb ingverb) %}
|
||||||
|
def self.{{data_type.id}}
|
||||||
|
Faker.fetch(Data["hacker"]["{{data_type.id}}"])
|
||||||
|
end
|
||||||
|
{% end %}
|
||||||
|
|
||||||
|
def self.phrases
|
||||||
|
["If we #{verb} the #{noun}, we can get to the #{abbreviation} #{noun} through the #{adjective} #{abbreviation} #{noun}!",
|
||||||
|
"We need to #{verb} the #{adjective} #{abbreviation} #{noun}!",
|
||||||
|
"Try to #{verb} the #{abbreviation} #{noun}, maybe it will #{verb} the #{adjective} #{noun}!",
|
||||||
|
"You can't #{verb} the #{noun} without #{ingverb} the #{adjective} #{abbreviation} #{noun}!",
|
||||||
|
"Use the #{adjective} #{abbreviation} #{noun}, then you can #{verb} the #{adjective} #{noun}!",
|
||||||
|
"The #{abbreviation} #{noun} is down, #{verb} the #{adjective} #{noun} so we can #{verb} the #{abbreviation} #{noun}!",
|
||||||
|
"#{ingverb} the #{noun} won't do anything, we need to #{verb} the #{adjective} #{abbreviation} #{noun}!",
|
||||||
|
"I'll #{verb} the #{adjective} #{abbreviation} #{noun}, that should #{noun} the #{abbreviation} #{noun}!",
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user