class Faker::Bot::Commands::Search
Runs a search against [Faker<Base>] methods and returns matching results
@api private
Public Instance Methods
execute(input, output: $stdout)
click to toggle source
Execute the `search` command
@return [IO]
@api private
# File lib/faker/bot/commands/search.rb, line 20 def execute(input, output: $stdout) result = Reflectors::Search.call(input) 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/search.rb, line 51 def not_found(output) output.puts "\nSorry, we couldn't find a match 😢", "\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/search.rb, line 37 def render(result, output) return not_found(output) if result.empty? super(result, output) end