Class: Faker::Bot::Reflectors::Search Private

Inherits:
Faker::Bot::Reflector show all
Defined in:
lib/faker/bot/reflectors/search.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Reflection object that searches all ‘Faker::Base` subclass methods

* Currently operates at O(n); improvements welcome. :)

Instance Attribute Summary collapse

Attributes inherited from Faker::Bot::Reflector

#descendants_with_methods

Instance Method Summary collapse

Methods inherited from Faker::Bot::Reflector

call

Constructor Details

#initialize(query) ⇒ Search

Initialize search reflector

Parameters:

  • query (String)

    The search query



28
29
30
31
32
# File 'lib/faker/bot/reflectors/search.rb', line 28

def initialize(query)
  @query = query.downcase

  super
end

Instance Attribute Details

#queryString? (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Reflector query

Returns:

  • (String, nil)


20
21
22
# File 'lib/faker/bot/reflectors/search.rb', line 20

def query
  @query
end

Instance Method Details

#callHash<Class => <Array<Symbol>>] when #show_methods is truthy

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Search through ‘Faker::Base` subclasses and return matching results

Returns:

  • (Hash<Class => <Array<Symbol>>] when #show_methods is truthy)

    Hash<Class => <Array<Symbol>>] when #show_methods is truthy



40
41
42
43
# File 'lib/faker/bot/reflectors/search.rb', line 40

def call
  search_descendants_matching_query
  descendants_with_methods
end