class Faker::Science
def element
-
(String)
-
def element fetch('science.element') end
def element_state
-
(String)
-
def element_state fetch('science.element_state') end
def element_subcategory
-
(String)
-
def element_subcategory fetch('science.element_subcategory') end
def element_symbol
-
(String)
-
def element_symbol fetch('science.element_symbol') end
def modifier
-
(String)
-
def modifier fetch('science.modifier') end
def science(*branches)
-
(String)
-
Parameters:
-
branches
(Array
) --
Other tags:
- See: Faker::Educator.subject -
See: https://en.wikipedia.org/wiki/Science#Branches_of_science -
def science(*branches) selected = BRANCHES.values.flatten.uniq branches.each do |branch| selected &= BRANCHES[branch] if BRANCHES.key? branch end raise ArgumentError, 'Filters do not match any sciences' if selected.empty? sciences = [] selected.each do |branch| sciences += translate("faker.science.branch.#{branch}") end sample(sciences) end
def scientist
-
(String)
-
def scientist fetch('science.scientist') end
def tool(simple: false)
-
(String)
-
Parameters:
-
simple
(Boolean
) -- Whether to generate simple realistic tool names, (no Q-word).
def tool(simple: false) tool = fetch('science.tool') return tool if simple # Makes sure the modifier are different loop do modifier = self.modifier break unless tool.start_with?(modifier) end "#{modifier} #{tool}" end