Skip to content

Commit

Permalink
Add Faker::GreekPhilosophers (#1300)
Browse files Browse the repository at this point in the history
* Added greek philosophers class, yaml file, test, and doc

* Update CHANGELOG.md

* Update README.md

* Update greek_philosophers.md
  • Loading branch information
15ngburton authored and vbrazo committed Jul 4, 2018
1 parent c5bd060 commit a20adad
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Change Log

## HEAD Unreleased
### Latest update: 2018-07-01
### Latest update: 2018-07-04

### Feature Request
- [PR #1300](https://github.com/stympy/faker/pull/1300) Add Faker::GreekPhilosophers [@15ngburton](https://github.com/15ngburton)
- [PR #1004](https://github.com/stympy/faker/pull/1004) Add Faker::Ethereum [@kaizenx](https://github.com/kaizenx)
- [PR #551](https://github.com/stympy/faker/pull/551) Add gender to name generator [@Maicolben](https://github.com/Maicolben)
- [PR #1283](https://github.com/stympy/faker/pull/1283) Add Faker::Military [@jjasghar](https://github.com/jjasghar)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Contents
- [Faker::FunnyName](doc/funny_name.md)
- [Faker::GameOfThrones](doc/game_of_thrones.md)
- [Faker::Gender](doc/gender.md)
- [Faker::GreekPhilosophers](doc/greek_philosophers.md)
- [Faker::Hacker](doc/hacker.md)
- [Faker::HarryPotter](doc/harry_potter.md)
- [Faker::HeyArnold](doc/hey_arnold.md)
Expand Down
9 changes: 9 additions & 0 deletions doc/greek_philosophers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Faker::GreekPhilosophers

It might be available in the next version.

```ruby
Faker::GreekPhilosophers.name #=> "Socrates"

Faker::GreekPhilosophers.quote #=> "Only the educated are free."
```
13 changes: 13 additions & 0 deletions lib/faker/greek_philosophers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module Faker
class GreekPhilosophers < Base
class << self
def name
fetch('greek_philosophers.names')
end

def quote
fetch('greek_philosophers.quotes')
end
end
end
end
26 changes: 26 additions & 0 deletions lib/locales/en/greek_philosophers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
en:
faker:
greek_philosophers:
names: ["Plato", "Aristotle", "Pythagoras", "Heraclitus", "Parmenides", "Democritus", "Zeno of Elea", "Epicurus", "Anaxagoras", "Diogenes", "Antisthenes", "Gorgias", "Hippocrates", "Plutarch", "Proclus", "Chrysippus", "Solon", "Archimedes", "Thucydides", "Arcesilaus", "Posidonius", "Galen"]
quotes: [
"Quality is not an act, it is a habit.",
"Only the educated are free.",
"Control thy passions lest they take vengence on thee.",
"Love is composed of a single soul inhabiting two bodies.",
"Rhetoric is the art of ruling the minds of men.",
"The unexamined life is not worth living.",
"There was never a genius without a tincture of madness.",
"Dignity does not consist in possessing honors, but in deserving them.",
"Most people would rather give than get affection.",
"Beware the barrenness of a busy life.",
"The secret to humor is surprise.",
"Pleasure in the job puts perfection in the work.",
"Philosophy is the highest music.",
"The virtue of justice consists in moderation, as regulated by wisdom.",
"Know how to listen, and you will profit even from those who talk badly.",
"A few vices are sufficient to darken many virtues.",
"It is impossible to begin to learn that which one thinks one already knows.",
"It's not what happens to you, but how you react to it that matters.",
"The mind is not a vessel to be filled but a fire to be kindled.",
"Good habits formed at youth make all the difference.",
]
15 changes: 15 additions & 0 deletions test/test_faker_greek_philosophers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require_relative 'test_helper'

class TestFakerGreekPhilosophers < Test::Unit::TestCase
def setup
@tester = Faker::GreekPhilosophers
end

def test_name
assert @tester.name.match(/\w+/)
end

def test_quote
assert @tester.quote.match(/\w+/)
end
end

0 comments on commit a20adad

Please sign in to comment.