Class: Faker::Creature::Bird

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

Constant Summary

Constants inherited from Base

Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, translate, unique, with_locale

Class Method Details

.adjectiveString

Produces a random adjective used to described birds

Examples:

Faker::Creature::Bird.adjective #=> 'common'

Returns:

  • (String)

Available since:

  • next


97
98
99
# File 'lib/faker/creature/bird.rb', line 97

def adjective
  fetch('creature.bird.adjectives')
end

.anatomyString

Produces a random bird anatomy word

Examples:

Faker::Creature::Bird.anatomy #=> "rump"

Returns:

  • (String)

Available since:

  • next


45
46
47
# File 'lib/faker/creature/bird.rb', line 45

def anatomy
  fetch('creature.bird.anatomy')
end

.anatomy_past_tenseString

Produces a random, past tensed bird anatomy word

Examples:

Faker::Creature::Bird.anatomy #=> "breasted"

Returns:

  • (String)

Available since:

  • next


58
59
60
# File 'lib/faker/creature/bird.rb', line 58

def anatomy_past_tense
  fetch('creature.bird.anatomy_past_tense')
end

.colorString

Produces a random color word used in describing birds

Examples:

Faker::Creature::Bird.color #=> "ferruginous"

Returns:

  • (String)

Available since:

  • next


84
85
86
# File 'lib/faker/creature/bird.rb', line 84

def color
  fetch('creature.bird.colors')
end

.common_family_nameString

Produces a random common family name of a bird.

Examples:

Faker::Creature::Bird.common_family_name #=> "Owls"

Returns:

  • (String)

Available since:

  • next


18
19
20
# File 'lib/faker/creature/bird.rb', line 18

def common_family_name
  fetch('creature.bird.common_family_name')
end

.common_name(tax_order = nil) ⇒ String

Produces a random common name for a bird

Examples:

Faker::Creature::Bird.common_name #=> 'wren'

Parameters:

  • tax_order (String | Symbol | nil) (defaults to: nil)

    Tax

Returns:

  • (String)

Available since:

  • next


141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/faker/creature/bird.rb', line 141

def common_name(tax_order = nil)
  map = translate('faker.creature.bird.order_common_map')
  if tax_order.nil?
    sample(map.values.flatten).downcase
  else
    raise TypeError, 'tax_order parameter must be symbolizable' \
      unless tax_order.respond_to?(:to_sym)
    raise ArgumentError, "#{tax_order} is not a valid taxonomic order" \
                         unless map.keys.include?(tax_order.to_sym)

    the_order = translate('faker.creature.bird.order_common_map')[tax_order.to_sym]
    sample(the_order).downcase
  end
end

.emotional_adjectiveString

Produces a random emotional adjective NOT used to described birds …but could be

Examples:

Faker::Creature::Bird.emotional_adjective #=> 'cantankerous'

Returns:

  • (String)

Available since:

  • next


111
112
113
# File 'lib/faker/creature/bird.rb', line 111

def emotional_adjective
  fetch('creature.bird.emotional_adjectives')
end

.geoString

Produces a random geographical word used in describing birds

Examples:

Faker::Creature::Bird.geo #=> "Eurasian"

Returns:

  • (String)

Available since:

  • next


71
72
73
# File 'lib/faker/creature/bird.rb', line 71

def geo
  fetch('creature.bird.geo')
end

.implausible_common_nameString

Produces a random and IMplausible common name for a bird

Examples:

Faker::Creature::Bird.implausible_common_name #=> 'Hellinger's Cantankerous Chickadee'

Returns:

  • (String)

Available since:

  • next


178
179
180
# File 'lib/faker/creature/bird.rb', line 178

def implausible_common_name
  parse('creature.bird.implausible_common_names').capitalize
end

.orderString

Produces a random common taxonomic order from the class Aves

Examples:

Faker::Creature::Bird.order #=> "Passeriformes"

Returns:

  • (String)

Available since:

  • next


31
32
33
34
# File 'lib/faker/creature/bird.rb', line 31

def order
  orders = I18n.translate('faker.creature.bird.order_common_map').keys
  sample(orders).to_s
end

.order_with_common_name(tax_order = nil) ⇒ Hash<order,common_name>

Produces a hash entry with a random order and a random common name that is of that order

}

Examples:

Faker::Creature::Bird.order_with_common_name #=> {
  order: ''Accipitriformes',
  common_name: 'Osprey'

Returns:

Available since:

  • next


195
196
197
198
199
# File 'lib/faker/creature/bird.rb', line 195

def order_with_common_name(tax_order = nil)
  map = I18n.translate('faker.creature.bird.order_common_map')
  o = tax_order.nil? ? order : tax_order
  { order: o, common_name: sample(map[o.to_sym]) }
end

.plausible_common_nameString

Produces a random and plausible common name for a bird

Examples:

Faker::Creature::Bird.plausible_common_name #=> 'Hellinger's Wren'

Returns:

  • (String)

Available since:

  • next


165
166
167
# File 'lib/faker/creature/bird.rb', line 165

def plausible_common_name
  parse('creature.bird.plausible_common_names').capitalize
end

.silly_adjectiveString

Produces a random adjective NOT used to described birds …but probably shouldn't

Examples:

Faker::Creature::Bird.silly_adjective #=> 'drunk'

Returns:

  • (String)

Available since:

  • next


125
126
127
# File 'lib/faker/creature/bird.rb', line 125

def silly_adjective
  fetch('creature.bird.silly_adjectives')
end