Class: FileAttributes

Inherits:
Object
  • Object
show all
Defined in:
lib/debt_ceiling/file_attributes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(analysed_file) ⇒ FileAttributes

Returns a new instance of FileAttributes.



3
4
5
6
7
8
9
# File 'lib/debt_ceiling/file_attributes.rb', line 3

def initialize(analysed_file)
  file_path        = analysed_file.path
  @linecount       = `wc -l #{file_path}`.match(/\d+/)[0].to_i
  @path            = file_path
  @analysed_module = analysed_file
  @source_code     = File.read(file_path)
end

Instance Attribute Details

#analysed_moduleObject (readonly)

Returns the value of attribute analysed_module.



2
3
4
# File 'lib/debt_ceiling/file_attributes.rb', line 2

def analysed_module
  @analysed_module
end

#linecountObject (readonly)

Returns the value of attribute linecount.



2
3
4
# File 'lib/debt_ceiling/file_attributes.rb', line 2

def linecount
  @linecount
end

#pathObject (readonly)

Returns the value of attribute path.



2
3
4
# File 'lib/debt_ceiling/file_attributes.rb', line 2

def path
  @path
end

#source_codeObject (readonly)

Returns the value of attribute source_code.



2
3
4
# File 'lib/debt_ceiling/file_attributes.rb', line 2

def source_code
  @source_code
end