Class: ArchUnit::Metrics::Extraction::ClassInfo

Inherits:
Data
  • Object
show all
Defined in:
lib/archunit/metrics/extraction/metric_info.rb

Overview

Static information about one Ruby class declaration. rubocop:disable Lint/DataDefineOverride -- methods is the established metric vocabulary.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, file_path:, methods: [], fields: []) ⇒ ClassInfo

Returns a new instance of ClassInfo.



77
78
79
80
81
82
83
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 77

def initialize(name:, file_path:, methods: [], fields: [])
  name = immutable_string(name, :name)
  file_path = immutable_string(file_path, :file_path, normalize_path: true)
  methods = immutable_values(methods, MethodInfo, :methods)
  fields = immutable_values(fields, FieldInfo, :fields)
  super
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields

Returns:

  • (Object)

    the current value of fields



74
75
76
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 74

def fields
  @fields
end

#file_pathObject (readonly)

Returns the value of attribute file_path

Returns:

  • (Object)

    the current value of file_path



74
75
76
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 74

def file_path
  @file_path
end

#methodsObject (readonly)

Returns the value of attribute methods

Returns:

  • (Object)

    the current value of methods



74
75
76
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 74

def methods
  @methods
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



74
75
76
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 74

def name
  @name
end

Instance Method Details

#identifierObject



85
86
87
# File 'lib/archunit/metrics/extraction/metric_info.rb', line 85

def identifier
  "#{file_path}:#{name}"
end