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

Refactor Faker::Educator and add docs #1772

Merged
merged 6 commits into from Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
66 changes: 60 additions & 6 deletions lib/faker/default/educator.rb
Expand Up @@ -5,30 +5,84 @@ class Educator < Base
flexible :educator

class << self
##
# Produces a university name.
#
# @return [String]
#
# @example
# Faker::Educator.university #=> "Mallowtown Technical College"
#
# @faker.version 1.6.4
def university
"#{parse('educator.name')} #{fetch('educator.tertiary.type')}"
parse('educator.university')
end

##
# Produces a university degree.
#
# @return [String]
#
# @example
# Faker::Educator.degree #=> "Associate Degree in Criminology"
#
# @faker.version 1.9.2
def degree
"#{fetch('educator.tertiary.degree.type')} #{fetch('educator.tertiary.degree.subject')}"
parse('educator.degree')
end

alias course degree

##
# Produces a university subject.
#
# @return [String]
#
# @example
# Faker::Educator.subject #=> "Criminology"
#
# @faker.version 1.9.2
def subject
fetch('educator.tertiary.degree.subject')
fetch('educator.subject')
end

##
# Produces a course name.
#
# @return [String]
#
# @example
# Faker::Educator.course_name #=> "Criminology 101"
#
# @faker.version 1.9.2
def course_name
"#{fetch('educator.tertiary.degree.subject')} #{numerify(fetch('educator.tertiary.degree.course_number'))}"
numerify(parse('educator.course_name'))
end

##
# Produces a secondary school.
#
# @return [String]
#
# @example
# Faker::Educator.secondary_school #=> "Iceborough Secondary College"
#
# @faker.version 1.6.4
def secondary_school
"#{parse('educator.name')} #{fetch('educator.secondary')}"
parse('educator.secondary_school')
end

##
# Produces a campus name.
#
# @return [String]
#
# @example
# Faker::Educator.campus #=> "Vertapple Campus"
#
# @faker.version 1.6.4
def campus
"#{parse('educator.name')} Campus"
parse('educator.campus')
end
end
end
Expand Down
75 changes: 69 additions & 6 deletions lib/locales/en/educator.yml
@@ -1,11 +1,74 @@
en:
faker:
educator:
name: ['Marblewald', 'Mallowtown', 'Brookville', 'Flowerlake', 'Falconholt', 'Ostbarrow', 'Lakeacre', 'Clearcourt', 'Ironston', 'Mallowpond', 'Iceborough', 'Icelyn', 'Brighthurst', 'Bluemeadow', 'Vertapple', 'Ironbarrow']
secondary: ['High School', 'Secondary College', 'High']
name:
- Bluemeadow
- Brighthurst
- Brookville
- Clearcourt
- Falconholt
- Flowerlake
- Iceborough
- Icelyn
- Ironbarrow
- Ironston
- Lakeacre
- Mallowpond
- Mallowtown
- Marblewald
- Ostbarrow
- Vertapple
secondary:
- High
- High School
- Secondary College
university:
- "#{name} #{Educator.tertiary.university_type}"
secondary_school:
- "#{name} #{secondary}"
campus:
- "#{name} Campus"
subject:
- Applied Science (Psychology)
- Architectural Technology
- Arts
- Biological Science
- Biomedical Science
- Business
- Commerce
- Communications
- Computer Science
- Creative Arts
- Criminology
- Design
- Education
- Engineering
- Forensic Science
- Health Science
- Information Systems
- Law
- Medicine
- Nursing
- Psychology
- Teaching
degree:
- "#{Educator.tertiary.degree.type} #{subject}"
course_name:
- "#{subject} #{Educator.tertiary.degree.course_number}"
tertiary:
type: ['College', 'University', 'Technical College', 'TAFE']
university_type:
- College
- TAFE
- Technical College
- University
degree:
subject: ['Arts', 'Business', 'Education', 'Applied Science (Psychology)', 'Architectural Technology', 'Biological Science', 'Biomedical Science', 'Commerce', 'Communications', 'Creative Arts', 'Criminology', 'Design', 'Engineering', 'Forensic Science', 'Health Science', 'Information Systems', 'Computer Science', 'Law', 'Nursing', 'Medicine', 'Psychology', 'Teaching']
type: ['Associate Degree in', 'Bachelor of', 'Master of']
course_number: ['1##', '2##', '3##', '4##', '5##']
type:
- Associate Degree in
- Bachelor of
- Master of
course_number:
- 1##
- 2##
- 3##
- 4##
- 5##