Class: FileAttributes
- Inherits:
-
Object
- Object
- FileAttributes
- Defined in:
- lib/debt_ceiling/file_attributes.rb
Instance Attribute Summary collapse
-
#analysed_module ⇒ Object
readonly
Returns the value of attribute analysed_module.
-
#linecount ⇒ Object
readonly
Returns the value of attribute linecount.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#source_code ⇒ Object
readonly
Returns the value of attribute source_code.
Instance Method Summary collapse
-
#initialize(analysed_file) ⇒ FileAttributes
constructor
A new instance of FileAttributes.
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_module ⇒ Object (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 |
#linecount ⇒ Object (readonly)
Returns the value of attribute linecount.
2 3 4 |
# File 'lib/debt_ceiling/file_attributes.rb', line 2 def linecount @linecount end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
2 3 4 |
# File 'lib/debt_ceiling/file_attributes.rb', line 2 def path @path end |
#source_code ⇒ Object (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 |