Class: ArchUnit::Metrics::Extraction::FileInfo
- Inherits:
-
Data
- Object
- Data
- ArchUnit::Metrics::Extraction::FileInfo
- Defined in:
- lib/archunit/metrics/extraction/metric_info.rb
Overview
Static counts and class declarations extracted from one Ruby source file.
Instance Attribute Summary collapse
-
#abstract_type_count ⇒ Object
readonly
Returns the value of attribute abstract_type_count.
-
#class_count ⇒ Object
readonly
Returns the value of attribute class_count.
-
#class_infos ⇒ Object
readonly
Returns the value of attribute class_infos.
-
#function_count ⇒ Object
readonly
Returns the value of attribute function_count.
-
#import_count ⇒ Object
readonly
Returns the value of attribute import_count.
-
#lines_of_code ⇒ Object
readonly
Returns the value of attribute lines_of_code.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#statement_count ⇒ Object
readonly
Returns the value of attribute statement_count.
-
#type_count ⇒ Object
readonly
Returns the value of attribute type_count.
Instance Method Summary collapse
-
#identifier ⇒ Object
-
#initialize(path:, lines_of_code:, statement_count:, import_count:, class_count:, function_count:, class_infos: [], type_count: nil, abstract_type_count: 0) ⇒ FileInfo
constructor
rubocop:disable-next Metrics/MethodLength, Metrics/ParameterLists – Independent count facts.
Constructor Details
#initialize(path:, lines_of_code:, statement_count:, import_count:, class_count:, function_count:, class_infos: [], type_count: nil, abstract_type_count: 0) ⇒ FileInfo
rubocop:disable-next Metrics/MethodLength, Metrics/ParameterLists – Independent count facts.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 105 def initialize( path:, lines_of_code:, statement_count:, import_count:, class_count:, function_count:, class_infos: [], type_count: nil, abstract_type_count: 0 ) path = immutable_string(path, :path, normalize_path: true) lines_of_code = non_negative_integer(lines_of_code, :lines_of_code) statement_count = non_negative_integer(statement_count, :statement_count) import_count = non_negative_integer(import_count, :import_count) class_count = non_negative_integer(class_count, :class_count) function_count = non_negative_integer(function_count, :function_count) class_infos = immutable_values(class_infos, ClassInfo, :class_infos) type_count = non_negative_integer(type_count || class_count, :type_count) abstract_type_count = non_negative_integer( abstract_type_count, :abstract_type_count ) if abstract_type_count > type_count raise ArgumentError, 'abstract_type_count cannot exceed type_count' end super end |
Instance Attribute Details
#abstract_type_count ⇒ Object (readonly)
Returns the value of attribute abstract_type_count
91 92 93 |
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 91 def abstract_type_count @abstract_type_count end |
#class_count ⇒ Object (readonly)
Returns the value of attribute class_count
91 92 93 |
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 91 def class_count @class_count end |
#class_infos ⇒ Object (readonly)
Returns the value of attribute class_infos
91 92 93 |
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 91 def class_infos @class_infos end |
#function_count ⇒ Object (readonly)
Returns the value of attribute function_count
91 92 93 |
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 91 def function_count @function_count end |
#import_count ⇒ Object (readonly)
Returns the value of attribute import_count
91 92 93 |
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 91 def import_count @import_count end |
#lines_of_code ⇒ Object (readonly)
Returns the value of attribute lines_of_code
91 92 93 |
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 91 def lines_of_code @lines_of_code end |
#path ⇒ Object (readonly)
Returns the value of attribute path
91 92 93 |
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 91 def path @path end |
#statement_count ⇒ Object (readonly)
Returns the value of attribute statement_count
91 92 93 |
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 91 def statement_count @statement_count end |
#type_count ⇒ Object (readonly)
Returns the value of attribute type_count
91 92 93 |
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 91 def type_count @type_count end |
Instance Method Details
#identifier ⇒ Object
134 135 136 |
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 134 def identifier path end |
ArchUnitRuby