Class: Faker::Bot::Reflectors::List Private

Inherits:
Faker::Bot::Reflector show all
Defined in:
lib/faker/bot/reflectors/list.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 lists all ‘Faker::Base` subclasses

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(options = {}) ⇒ List

Initialize list reflector

Parameters:

  • options (Hash{Symbol => Boolean, nil}) (defaults to: {})

    Reflector options

Options Hash (options):

  • :show_method (Boolean, nil)

    Show methods in listing boolean flag



36
37
38
39
40
41
# File 'lib/faker/bot/reflectors/list.rb', line 36

def initialize(options = {})
  @filter = options[:filter]
  @show_methods = options[:show_methods]

  super
end

Instance Attribute Details

#filterString? (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.

Output filter

Returns:

  • (String, nil)


19
20
21
# File 'lib/faker/bot/reflectors/list.rb', line 19

def filter
  @filter
end

#show_methodsBoolean? (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.

Boolean flag on whether to list methods or not

Returns:

  • (Boolean, nil)


26
27
28
# File 'lib/faker/bot/reflectors/list.rb', line 26

def show_methods
  @show_methods
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.

List ‘Faker::Base` subclasses

Returns:

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

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



49
50
51
52
53
54
55
# File 'lib/faker/bot/reflectors/list.rb', line 49

def call
  if show_methods
    list_descendants_with_methods
  else
    list_descendants
  end
end