Class: ArchUnit::Files::Extraction::FileInfo

Inherits:
Data
  • Object
show all
Defined in:
lib/archunit/files/extraction/file_info.rb

Overview

Immutable source-file information exposed to custom predicates.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, name:, extension:, directory:, content:, lines_of_code:) ⇒ FileInfo

rubocop:disable Metrics/ParameterLists -- FileInfo has six required public fields.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/archunit/files/extraction/file_info.rb', line 12

def initialize(path:, name:, extension:, directory:, content:, lines_of_code:)
  path = immutable_string(path, :path, allow_empty: false, normalize_path: true)
  name = immutable_string(name, :name, allow_empty: false)
  extension = immutable_string(extension, :extension, allow_empty: true)
  directory = immutable_string(
    directory, :directory, allow_empty: true, normalize_path: true
  )
  content = immutable_string(content, :content, allow_empty: true)
  lines_of_code = non_negative_integer(lines_of_code)
  super
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content

Returns:

  • (Object)

    the current value of content



8
9
10
# File 'lib/archunit/files/extraction/file_info.rb', line 8

def content
  @content
end

#directoryObject (readonly)

Returns the value of attribute directory

Returns:

  • (Object)

    the current value of directory



8
9
10
# File 'lib/archunit/files/extraction/file_info.rb', line 8

def directory
  @directory
end

#extensionObject (readonly)

Returns the value of attribute extension

Returns:

  • (Object)

    the current value of extension



8
9
10
# File 'lib/archunit/files/extraction/file_info.rb', line 8

def extension
  @extension
end

#lines_of_codeObject (readonly)

Returns the value of attribute lines_of_code

Returns:

  • (Object)

    the current value of lines_of_code



8
9
10
# File 'lib/archunit/files/extraction/file_info.rb', line 8

def lines_of_code
  @lines_of_code
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



8
9
10
# File 'lib/archunit/files/extraction/file_info.rb', line 8

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



8
9
10
# File 'lib/archunit/files/extraction/file_info.rb', line 8

def path
  @path
end