Class: ArchUnit::GraphReporting::Projection::GraphQueryOptions

Inherits:
Data
  • Object
show all
Defined in:
lib/archunit/graph/projection/graph_query_options.rb

Overview

Immutable selection, collapsing, and presentation options for a graph snapshot.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(include_external_dependencies: false, include_self_dependencies: false, focus: nil, focus_depth: 1, reachable_from: nil, dependents_of: nil, collapse: nil, title: nil) ⇒ GraphQueryOptions

The options bag deliberately mirrors the eight independent fluent modifiers. rubocop:disable Metrics/ParameterLists



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/archunit/graph/projection/graph_query_options.rb', line 25

def initialize(
  include_external_dependencies: false, include_self_dependencies: false,
  focus: nil, focus_depth: 1, reachable_from: nil, dependents_of: nil,
  collapse: nil, title: nil
)
  validate_boolean(include_external_dependencies, :include_external_dependencies)
  validate_boolean(include_self_dependencies, :include_self_dependencies)
  validate_filter(focus, :focus)
  validate_focus_depth(focus_depth)
  validate_filter(reachable_from, :reachable_from)
  validate_filter(dependents_of, :dependents_of)
  validate_collapse(collapse)
  title = immutable_title(title)
  super
end

Instance Attribute Details

#collapseObject (readonly)

Returns the value of attribute collapse

Returns:

  • (Object)

    the current value of collapse



11
12
13
# File 'lib/archunit/graph/projection/graph_query_options.rb', line 11

def collapse
  @collapse
end

#dependents_ofObject (readonly)

Returns the value of attribute dependents_of

Returns:

  • (Object)

    the current value of dependents_of



11
12
13
# File 'lib/archunit/graph/projection/graph_query_options.rb', line 11

def dependents_of
  @dependents_of
end

#focusObject (readonly)

Returns the value of attribute focus

Returns:

  • (Object)

    the current value of focus



11
12
13
# File 'lib/archunit/graph/projection/graph_query_options.rb', line 11

def focus
  @focus
end

#focus_depthObject (readonly)

Returns the value of attribute focus_depth

Returns:

  • (Object)

    the current value of focus_depth



11
12
13
# File 'lib/archunit/graph/projection/graph_query_options.rb', line 11

def focus_depth
  @focus_depth
end

#include_external_dependenciesObject (readonly)

Returns the value of attribute include_external_dependencies

Returns:

  • (Object)

    the current value of include_external_dependencies



11
12
13
# File 'lib/archunit/graph/projection/graph_query_options.rb', line 11

def include_external_dependencies
  @include_external_dependencies
end

#include_self_dependenciesObject (readonly)

Returns the value of attribute include_self_dependencies

Returns:

  • (Object)

    the current value of include_self_dependencies



11
12
13
# File 'lib/archunit/graph/projection/graph_query_options.rb', line 11

def include_self_dependencies
  @include_self_dependencies
end

#reachable_fromObject (readonly)

Returns the value of attribute reachable_from

Returns:

  • (Object)

    the current value of reachable_from



11
12
13
# File 'lib/archunit/graph/projection/graph_query_options.rb', line 11

def reachable_from
  @reachable_from
end

#titleObject (readonly)

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



11
12
13
# File 'lib/archunit/graph/projection/graph_query_options.rb', line 11

def title
  @title
end

Class Method Details

.resolve(value) ⇒ Object

Raises:

  • (ArgumentError)


16
17
18
19
20
21
# File 'lib/archunit/graph/projection/graph_query_options.rb', line 16

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

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

Instance Method Details

#with(**overrides) ⇒ Object

rubocop:enable Metrics/ParameterLists



42
43
44
# File 'lib/archunit/graph/projection/graph_query_options.rb', line 42

def with(**overrides)
  self.class.new(**to_h, **overrides)
end