Class: FakerBot::Reflector Private
- Inherits:
-
Object
- Object
- FakerBot::Reflector
- 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
- #descendants_with_methods ⇒ Object readonly private
- #query ⇒ Object readonly private
Class Method Summary collapse
- .find(query) ⇒ Object private
- .list(show_methods: false) ⇒ Object private
Instance Method Summary collapse
- #find ⇒ Object private
-
#initialize(query = nil) ⇒ Reflector
constructor
private
A new instance of Reflector.
- #list(show_methods) ⇒ Object private
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_methods ⇒ Object (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 |
#query ⇒ Object (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
#find ⇒ 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.
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 |