Class: Analyst::Entities::Class

Inherits:
Module show all
Defined in:
lib/analyst/entities/class.rb

Instance Attribute Summary

Attributes inherited from Entity

#ast, #parent

Instance Method Summary collapse

Methods inherited from Module

#full_name, #name

Methods inherited from Entity

#classes, #conditionals, #constants, #file_path, #full_name, handles_node, #initialize, #inspect, #line_number, #location, #method_calls, #methods, #modules, #origin_source, #source, #top_level_classes, #top_level_constants, #top_level_modules

Constructor Details

This class inherits a constructor from Analyst::Entities::Entity

Instance Method Details

#all_methodsObject



29
30
31
# File 'lib/analyst/entities/class.rb', line 29

def all_methods
  cmethods + imethods
end

#cmethodsObject



23
24
25
26
27
# File 'lib/analyst/entities/class.rb', line 23

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



19
20
21
# File 'lib/analyst/entities/class.rb', line 19

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

#kindObject



15
16
17
# File 'lib/analyst/entities/class.rb', line 15

def kind
  "Class"
end

#singleton_class_blocksObject



33
34
35
# File 'lib/analyst/entities/class.rb', line 33

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