Class: ArchUnit::Metrics::Reporting::MetricsExportOptions

Inherits:
Data
  • Object
show all
Defined in:
lib/archunit/metrics/reporting/metrics_export_options.rb

Overview

Immutable options for one metrics HTML report.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output_path: nil, title: 'ArchUnitRuby Metrics Report', include_timestamp: true, custom_css: nil) ⇒ MetricsExportOptions

Returns a new instance of MetricsExportOptions.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/archunit/metrics/reporting/metrics_export_options.rb', line 18

def initialize(
  output_path: nil,
  title: 'ArchUnitRuby Metrics Report',
  include_timestamp: true,
  custom_css: nil
)
  output_path = optional_path(output_path)
  title = immutable_string(title, :title)
  unless [true, false].include?(include_timestamp)
    raise ArgumentError, 'include_timestamp must be true or false'
  end

  custom_css = optional_string(custom_css, :custom_css)
  super
end

Instance Attribute Details

#custom_cssObject (readonly)

Returns the value of attribute custom_css

Returns:

  • (Object)

    the current value of custom_css



8
9
10
# File 'lib/archunit/metrics/reporting/metrics_export_options.rb', line 8

def custom_css
  @custom_css
end

#include_timestampObject (readonly)

Returns the value of attribute include_timestamp

Returns:

  • (Object)

    the current value of include_timestamp



8
9
10
# File 'lib/archunit/metrics/reporting/metrics_export_options.rb', line 8

def include_timestamp
  @include_timestamp
end

#output_pathObject (readonly)

Returns the value of attribute output_path

Returns:

  • (Object)

    the current value of output_path



8
9
10
# File 'lib/archunit/metrics/reporting/metrics_export_options.rb', line 8

def output_path
  @output_path
end

#titleObject (readonly)

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



8
9
10
# File 'lib/archunit/metrics/reporting/metrics_export_options.rb', line 8

def title
  @title
end

Class Method Details

.resolve(value) ⇒ Object

Raises:

  • (ArgumentError)


11
12
13
14
15
16
# File 'lib/archunit/metrics/reporting/metrics_export_options.rb', line 11

def self.resolve(value)
  return new if value.nil?
  return value if value.is_a?(self)

  raise ArgumentError, 'options must be a MetricsExportOptions value or nil'
end