Sha256: 639b9317a86e4bef39903f86ce439217926869f010c986c340bd08ee3dfd73a7
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
# frozen_string_literal: true require_relative '../command' require_relative '../reflectors/list' module Faker module Bot module Commands # Lists all [Faker<Base>] constants # # @api private # class List < Command # Execute the `list` command # # @return [IO] # # @api private # def execute(output: $stdout) result = Reflectors::List.call(options) render(result, output) end private # 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 # def render(result, output) return not_found(output) if result.empty? super(result, output) end # Render a bespoke "not found" message # # @param output [IO] # # @return [IO] # # @api private # def not_found(output) output.puts "\nSorry, that class doesn't exist 😢", "\n", 'Try something like `Faker::Beer` or `Beer`.', "\n" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
faker-bot-0.5.3 | lib/faker/bot/commands/list.rb |
faker-bot-0.5.2 | lib/faker/bot/commands/list.rb |
faker-bot-0.5.1 | lib/faker/bot/commands/list.rb |