Module: Analyst::Entities::HasMethods

Included in:
Class, Module
Defined in:
lib/analyst/entities/mixins/has_methods.rb

Instance Method Summary collapse

Instance Method Details

#all_methodsObject



17
18
19
# File 'lib/analyst/entities/mixins/has_methods.rb', line 17

def all_methods
  cmethods + imethods
end

#cmethodsObject



11
12
13
14
15
# File 'lib/analyst/entities/mixins/has_methods.rb', line 11

def cmethods
  some_methods = smethods.select { |method| method.target.type == :self }
  other_methods = singleton_class_blocks { |block| block.target.type == :self }.map(&:smethods).flatten
  some_methods + other_methods
end

#imethodsObject



7
8
9
# File 'lib/analyst/entities/mixins/has_methods.rb', line 7

def imethods
  @imethods ||= contents.select { |entity| entity.is_a? Analyst::Entities::InstanceMethod }
end

#singleton_class_blocksObject



21
22
23
# File 'lib/analyst/entities/mixins/has_methods.rb', line 21

def singleton_class_blocks
  contents.select { |entity| entity.is_a? Analyst::Entities::SingletonClass }
end