class Faker::Bot::Commands::List

Lists all [Faker<Base>] constants

@api private

Public Instance Methods

execute(output: $stdout) click to toggle source

Execute the `list` command

@return [IO]

@api private

# File lib/faker/bot/commands/list.rb, line 20
def execute(output: $stdout)
  result = Reflectors::List.call(options)
  render(result, output)
end

Private Instance Methods

not_found(output) click to toggle source

Render a bespoke “not found” message

@param output [IO]

@return [IO]

@api private

# File lib/faker/bot/commands/list.rb, line 51
def not_found(output)
  output.puts "\nSorry, that class doesn't exist 😢", "\n",
              'Try something like `Faker::Beer` or `Beer`.', "\n"
end
render(result, output) click to toggle source

Render the search results

* Return #not_found when there're no matching results

@param result [Hash] the render tree @param output [IO]

@return [IO]

@api private

Calls superclass method Faker::Bot::Command#render
# File lib/faker/bot/commands/list.rb, line 37
def render(result, output)
  return not_found(output) if result.empty?

  super(result, output)
end