Class: Snuffle::SourceFile

Inherits:
Object
  • Object
show all
Includes:
PoroPlus
Defined in:
lib/snuffle/source_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#lines_of_codeObject

Returns the value of attribute lines_of_code.



11
12
13
# File 'lib/snuffle/source_file.rb', line 11

def lines_of_code
  @lines_of_code
end

#path_to_fileObject

Returns the value of attribute path_to_file.



11
12
13
# File 'lib/snuffle/source_file.rb', line 11

def path_to_file
  @path_to_file
end

#sourceObject

Returns the value of attribute source.



11
12
13
# File 'lib/snuffle/source_file.rb', line 11

def source
  @source
end

Instance Method Details

#arg_clumpsObject



22
23
24
# File 'lib/snuffle/source_file.rb', line 22

def arg_clumps
  @arg_clumps ||= ArgsClump.from(self.nodes)
end

#class_nameObject



13
14
15
16
# File 'lib/snuffle/source_file.rb', line 13

def class_name
  return @class_name if @class_name
  @class_name = find_class(ast) || "?"
end

#cohortsObject



26
27
28
# File 'lib/snuffle/source_file.rb', line 26

def cohorts
  @cohorts ||= Cohort.from(self.nodes)
end

#latent_objectsObject



30
31
32
# File 'lib/snuffle/source_file.rb', line 30

def latent_objects
  @latent_objects ||= LatentObject.from(self.nodes)
end

#nodesObject



18
19
20
# File 'lib/snuffle/source_file.rb', line 18

def nodes
  @nodes ||= extract_nodes_from(ast)
end

#summaryObject



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/snuffle/source_file.rb', line 46

def summary
  Summary.new(
    source_file: self,
    source: self.source,
    class_name: class_name,
    path_to_file: self.path_to_file,
    cohorts: cohorts,
    latent_objects: latent_objects,
    arg_clumps: arg_clumps
  )
end