Skip to content

Commit

Permalink
Add two generators to Faker::Science (#2175)
Browse files Browse the repository at this point in the history
* Change write style to new version

* Add element state and subcategory to yaml file

* Add classes and tests for selement state and subcategory

* Update science.md file

* Add plasma to element state in .yml file
  • Loading branch information
RubyHuntsman committed Apr 16, 2021
1 parent 41c6f24 commit afd7680
Show file tree
Hide file tree
Showing 4 changed files with 393 additions and 3 deletions.
4 changes: 4 additions & 0 deletions doc/default/science.md
Expand Up @@ -5,5 +5,9 @@ Faker::Science.element #=> "Carbon"

Faker::Science.element_symbol #=> "Pb"

Faker::Science.element_state #=> "Liquid"

Faker::Science.element_subcategory #=> "Reactive nonmetal"

Faker::Science.scientist #=> "Isaac Newton"
```
26 changes: 26 additions & 0 deletions lib/faker/default/science.rb
Expand Up @@ -29,6 +29,32 @@ def element_symbol
fetch('science.element_symbol')
end

##
# Produces the state of an element.
#
# @return [String]
#
# @example
# Faker::Science.element_state #=> "Liquid"
#
# @faker.version next
def element_state
fetch('science.element_state')
end

##
# Produces the subcategory of an element.
#
# @return [String]
#
# @example
# Faker::Science.element_subcategory #=> "Reactive nonmetal"
#
# @faker.version next
def element_subcategory
fetch('science.element_subcategory')
end

##
# Produces the name of a scientist.
#
Expand Down

0 comments on commit afd7680

Please sign in to comment.