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

Add minecraft generators #2064

Merged
merged 2 commits into from
Jun 19, 2020
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions doc/games/minecraft.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Faker::Games::Minecraft

```ruby

# Generate random block from Minecraft
Faker::Games::Minecraft.block # => "Stone"

# Generate random item from Minecraft
Faker::Games::Minecraft.item # => "Iron Shovel"

# Generate random mob from Minecraft
Faker::Games::Minecraft.mob # => "Sheep"
48 changes: 48 additions & 0 deletions lib/faker/games/minecraft.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true

module Faker
class Games
class Minecraft < Base
class << self
##
# Produces the name of a block from Minecraft.
#
# @return [String]
#
# @example
# Faker::Games::Minecraft.block #=> "Stone"
#
# @faker.version next
def block
fetch('games.minecraft.blocks')
end

##
# Produces the name of an item from Minecraft.
#
# @return [String]
#
# @example
# Faker::Games::Minecraft.item #=> "Iron Shovel"
#
# @faker.version next
def item
fetch('games.minecraft.items')
end

##
# Produces the name of a mob from Minecraft.
#
# @return [String]
#
# @example
# Faker::Games::Minecraft.item #=> "Sheep"
#
# @faker.version next
def mob
fetch('games.minecraft.mobs')
end
end
end
end
end
Loading