Skip to content

Commit

Permalink
Merge pull request #1959 from rutger-t/add-yard-doc-university
Browse files Browse the repository at this point in the history
add YARD docs to Faker::University
  • Loading branch information
Zeragamba committed May 17, 2020
2 parents c491e64 + 2ea06d2 commit 0064d53
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .rubocop.yml
Expand Up @@ -40,6 +40,11 @@ Metrics/PerceivedComplexity:
Enabled: false
Max: 7

Style/AsciiComments:
Description: This cop checks for non-ascii (non-English) characters in comments.
Exclude:
- 'lib/faker/default/university.rb'

Style/DateTime:
Description: This cop checks for consistent usage of the DateTime class over the Time class.
Enabled: false
Expand Down
45 changes: 45 additions & 0 deletions lib/faker/default/university.rb
Expand Up @@ -5,22 +5,67 @@ class University < Base
flexible :university

class << self
##
# Produces a random university name
#
# @return [String]
#
# @example
# Faker::University.name #=> "Eastern Mississippi Academy"
#
# @faker.version 1.5.0
def name
parse('university.name')
end

##
# Produces a random university prefix
#
# @return [String]
#
# @example
# Faker::University.prefix #=> "Western"
#
# @faker.version 1.5.0
def prefix
fetch('university.prefix')
end

##
# Produces a random university suffix
#
# @return [String]
#
# @example
# Faker::University.suffix #=> "Academy"
#
# @faker.version 1.5.0
def suffix
fetch('university.suffix')
end

##
# Produces a random greek organization
#
# @return [String]
#
# @example
# Faker::University.greek_organization #=> "BEX"
#
# @faker.version 1.5.0
def greek_organization
Array.new(3) { |_| sample(greek_alphabet) }.join
end

##
# Produces a greek alphabet
#
# @return [Array]
#
# @example
# Faker::University.greek_alphabet #=> ["Α", "B", "Γ", "Δ", ...]
#
# @faker.version 1.5.0
def greek_alphabet
%w[Α B Γ Δ E Z H Θ I K Λ M N Ξ
O Π P Σ T Y Φ X Ψ Ω]
Expand Down

0 comments on commit 0064d53

Please sign in to comment.