Class: Reflexive::Methods
- Inherits:
-
Object
- Object
- Reflexive::Methods
- Defined in:
- lib/reflexive/methods.rb
Constant Summary collapse
- VISIBILITIES =
[ :public, :protected, :private ].freeze
Instance Method Summary collapse
- #all ⇒ Object
- #constants ⇒ Object
- #descendants ⇒ Object
- #files ⇒ Object
-
#initialize(klass_or_module, options = {}) ⇒ Methods
constructor
A new instance of Methods.
Constructor Details
#initialize(klass_or_module, options = {}) ⇒ Methods
Returns a new instance of Methods.
6 7 8 9 10 11 |
# File 'lib/reflexive/methods.rb', line 6 def initialize(klass_or_module, = {}) @klass_or_module = klass_or_module @ancestor_name_formatter = .fetch(:ancestor_name_formatter, default_ancestor_name_formatter) @exclude_trite = .fetch(:exclude_trite, true) end |
Instance Method Details
#all ⇒ Object
13 14 15 |
# File 'lib/reflexive/methods.rb', line 13 def all @all ||= find_all end |
#constants ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/reflexive/methods.rb', line 21 def constants @constants ||= @klass_or_module.constants(true).map do |c| @klass_or_module.const_get(c) rescue nil end.compact.select do |c| c.instance_of?(Class) || c.instance_of?(Module) end # rescue r(@klass_or_module.constants) end |
#descendants ⇒ Object
29 30 31 |
# File 'lib/reflexive/methods.rb', line 29 def descendants @descendants ||= Reflexive.descendants(@klass_or_module) end |
#files ⇒ Object
17 18 19 |
# File 'lib/reflexive/methods.rb', line 17 def files @files ||= find_all_files end |