class Faker::Bot::Reflectors::List
Reflection object that lists all `Faker::Base` subclasses
@api private
Attributes
filter[R]
Output filter
@return [String, nil]
@api private
show_methods[R]
Boolean flag on whether to list methods or not
@return [Boolean, nil]
@api private
Public Class Methods
new(options = {})
click to toggle source
Initialize list reflector
@param options [Hash{Symbol => Boolean, nil}] Reflector
options @option options [Boolean, nil] :show_method
Show methods in listing boolean flag
@api public
Calls superclass method
Faker::Bot::Reflector::new
# File lib/faker/bot/reflectors/list.rb, line 36 def initialize(options = {}) @filter = options[:filter] @show_methods = options[:show_methods] super end
Public Instance Methods
call()
click to toggle source
List
`Faker::Base` subclasses
@return [Hash<Class => <Array<Symbol>>] when show_methods
is truthy
@api private
# File lib/faker/bot/reflectors/list.rb, line 49 def call if show_methods list_descendants_with_methods else list_descendants end end
Private Instance Methods
filter_matches_class_name?(class_name)
click to toggle source
Match against class name when filter is defined
@return [Boolean]
@api private
# File lib/faker/bot/reflectors/list.rb, line 91 def filter_matches_class_name?(class_name) return true unless filter class_name.match(/#{filter}/i) end
list_descendants()
click to toggle source
List
`Faker::Base` subclasses
@return [Array<Class>]
@api private
# File lib/faker/bot/reflectors/list.rb, line 76 def list_descendants faker_descendants.each do |descendant| if filter_matches_class_name?(descendant.to_s) store(descendant, descendant.my_singleton_methods) end end descendants_with_methods.keys end
list_descendants_with_methods()
click to toggle source
List
`Faker::Base` subclasses with methods
@return [Hash{Class => <Array<Symbol>}]
@api private
# File lib/faker/bot/reflectors/list.rb, line 65 def list_descendants_with_methods list_descendants descendants_with_methods end