Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add birds #2299

Merged
merged 19 commits into from Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5449ac5
added tests for all simple bird look-ups
brotherjack Apr 11, 2021
d3960a7
added bird words (bird is the word)
brotherjack Apr 11, 2021
1a98283
added birds!
brotherjack Apr 11, 2021
51ecf8a
added tests for plausible and implausible common names for birds and …
brotherjack Apr 12, 2021
3ae6766
added .plausible_common_name and .implausible_common_name and made .c…
brotherjack Apr 12, 2021
714368b
added documentation of bird methods
brotherjack Apr 13, 2021
1dad858
corrected Rubocop offenses and made test failures on #test_plausible_…
brotherjack Apr 14, 2021
a39f9ba
fixed TestFakerCreatureBird#test_plausible_common_names to allow for …
brotherjack Apr 14, 2021
28e2682
Apply suggestions from code review
brotherjack Apr 18, 2021
f22159c
added a test for #order_with_common_names
brotherjack Apr 18, 2021
2fba0aa
modified list to allow for matching common names to orders
brotherjack Apr 18, 2021
99a7ff4
tests for new versions of Faker::Creature::Bird #order_with_common_na…
brotherjack Apr 18, 2021
95fc715
added tests to make sure that Faker::Creature::Bird #common_name and …
brotherjack Apr 18, 2021
824072f
corrected Faker::Creature::Bird #order_with_common_name and made #com…
brotherjack Apr 18, 2021
fdb504f
changed @faker.version to correct next version
brotherjack Apr 19, 2021
5288678
corrected rubocop offenses
brotherjack Apr 19, 2021
cb1403d
updated documentation
brotherjack Apr 19, 2021
9dcf769
added additional silly - management apologizes for the insufficient i…
brotherjack Apr 19, 2021
fa3cc07
Fix typo in documentation doc/creature/bird.md
brotherjack Apr 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 39 additions & 0 deletions doc/creature/bird.md
@@ -0,0 +1,39 @@
# Faker::Creature::Bird

```ruby
# Random common family name of a bird
Faker::Creature::Bird.common_family_name #=> "Owls"

# Random taxonomic order from the class Aves (ie. those are birds)
Faker::Creature::Bird.order #=> "Passeriformes" # Fun fact, 60% of birds are Passeriformes!

# Random bird anatomy word
Faker::Creature::Bird.anatomy #=> "rump"

# Random bird anatomy word, in the past tense
Faker::Creature::Bird.anatomy #=> "breasted"
brotherjack marked this conversation as resolved.
Show resolved Hide resolved

# Random bird geography word
Faker::Creature::Bird.geo #=> "Eurasian"

# Random bird color word
Faker::Creature::Bird.color #=> "ferruginous"

# Random bird adjective word
Faker::Creature::Bird.adjective #=> "common"

# Random emotional adjective NOT typically used in bird names
Faker::Creature::Bird.emotional_adjective #=> "cantankerous"

# Random silly adjective NOT used in bird names
Faker::Creature::Bird.silly_adjective #=> "drunk"

# Random common name for a bird
Faker::Creature::Bird.common_name #=> 'wren'

# Random plausible common name for a bird
Faker::Creature::Bird.plausible_common_name #=> 'Hellinger's Wren'

# Random implausible common name for a bird
Faker::Creature::Bird.implausible_common_name #=> 'Hellinger's Cantankerous Chickadee'
```
169 changes: 169 additions & 0 deletions lib/faker/creature/bird.rb
@@ -0,0 +1,169 @@
# frozen_string_literal: true

module Faker
class Creature
class Bird < Base
flexible :bird

class << self
##
# Produces a random common family name of a bird
brotherjack marked this conversation as resolved.
Show resolved Hide resolved
#
# @return [String]
#
# @example
# Faker::Creature::Bird.common_family_name #=> "Owls"
#
# @faker.version 2.16.0
brotherjack marked this conversation as resolved.
Show resolved Hide resolved
def common_family_name
fetch('creature.bird.common_family_name')
end

##
# Produces a random common taxonomic order from the class Aves
#
# @return [String]
#
# @example
# Faker::Creature::Bird.order #=> "Passeriformes"
#
# @faker.version 2.16.0
def order
fetch('creature.bird.order')
end

##
# Produces a random bird anatomy word
#
# @return [String]
#
# @example
# Faker::Creature::Bird.anatomy #=> "rump"
#
# @faker.version 2.16.0
def anatomy
fetch('creature.bird.anatomy')
end

##
# Produces a random, past tensed bird anatomy word
#
# @return [String]
#
# @example
# Faker::Creature::Bird.anatomy #=> "breasted"
#
# @faker.version 2.16.0
def anatomy_past_tense
fetch('creature.bird.anatomy_past_tense')
end

##
# Produces a random geographical word used in describing birds
#
# @return [String]
#
# @example
# Faker::Creature::Bird.geo #=> "Eurasian"
#
# @faker.version 2.16.0
def geo
fetch('creature.bird.geo')
end

##
# Produces a random color word used in describing birds
#
# @return [String]
#
# @example
# Faker::Creature::Bird.color #=> "ferruginous"
#
# @faker.version 2.16.0
def color
fetch('creature.bird.colors')
end

##
# Produces a random adjective used to described birds
#
# @return [String]
#
# @example
# Faker::Creature::Bird.adjective #=> 'common'
#
# @faker.version 2.16.0
def adjective
fetch('creature.bird.adjectives')
end

##
# Produces a random emotional adjective NOT used to described birds
# ...but could be
#
# @return [String]
#
# @example
# Faker::Creature::Bird.emotional_adjective #=> 'cantankerous'
#
# @faker.version 2.16.0
def emotional_adjective
fetch('creature.bird.emotional_adjectives')
end

##
# Produces a random adjective NOT used to described birds
# ...but probably shouldn't
#
# @return [String]
#
# @example
# Faker::Creature::Bird.silly_adjective #=> 'drunk'
#
# @faker.version 2.16.0
def silly_adjective
fetch('creature.bird.silly_adjectives')
end

##
# Produces a random common name for a bird
#
# @return [String]
#
# @example
# Faker::Creature::Bird.common_name #=> 'wren'
#
# @faker.version 2.16.0
def common_name
fetch('creature.bird.common_names').downcase
end

##
# Produces a random and plausible common name for a bird
#
# @return [String]
#
# @example
# Faker::Creature::Bird.plausible_common_name #=> 'Hellinger's Wren'
#
# @faker.version 2.16.0
def plausible_common_name
parse('creature.bird.plausible_common_names').capitalize
end

##
# Produces a random and IMplausible common name for a bird
#
# @return [String]
#
# @example
# Faker::Creature::Bird.implausible_common_name #=> 'Hellinger's Cantankerous Chickadee'
#
# @faker.version 2.16.0
def implausible_common_name
parse('creature.bird.implausible_common_names').capitalize
end
end
end
end
end