Class: FakerBot::Reflector Private

Inherits:
Object
  • Object
show all
Defined in:
lib/fakerbot/reflector.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.

Exposes Faker reflection methods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query = nil) ⇒ Reflector

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.

Returns a new instance of Reflector.



27
28
29
30
# File 'lib/fakerbot/reflector.rb', line 27

def initialize(query = nil)
  @descendants_with_methods = Hash.new { |h, k| h[k] = [] }
  @query = query
end

Instance Attribute Details

#descendants_with_methodsObject (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.



25
26
27
# File 'lib/fakerbot/reflector.rb', line 25

def descendants_with_methods
  @descendants_with_methods
end

#queryObject (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.



25
26
27
# File 'lib/fakerbot/reflector.rb', line 25

def query
  @query
end

Class Method Details

.find(query) ⇒ Object

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.



33
34
35
# File 'lib/fakerbot/reflector.rb', line 33

def find(query)
  new(query).find
end

.list(show_methods: false) ⇒ Object

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.



37
38
39
# File 'lib/fakerbot/reflector.rb', line 37

def list(show_methods: false)
  new.list(show_methods)
end

Instance Method Details

#findObject

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.



42
43
44
45
# File 'lib/fakerbot/reflector.rb', line 42

def find
  search_descendants_matching_query
  descendants_with_methods
end

#list(show_methods) ⇒ Object

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.



47
48
49
# File 'lib/fakerbot/reflector.rb', line 47

def list(show_methods)
  show_methods ? all_descendants_with_methods : faker_descendants
end