Class: CodeOwnership::Private::ForFileOutputBuilder

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/code_ownership/private/for_file_output_builder.rb

Constant Summary collapse

UNOWNED_OUTPUT =
T.let(
  {
    team_name: 'Unowned',
    team_yml: 'Unowned'
  },
  T::Hash[Symbol, T.untyped]
)

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path:, json:, verbose:) ⇒ ForFileOutputBuilder

Returns a new instance of ForFileOutputBuilder.



13
14
15
16
17
# File 'lib/code_ownership/private/for_file_output_builder.rb', line 13

def initialize(file_path:, json:, verbose:)
  @file_path = file_path
  @json = json
  @verbose = verbose
end

Class Method Details

.build(file_path:, json:, verbose:) ⇒ Object



20
21
22
# File 'lib/code_ownership/private/for_file_output_builder.rb', line 20

def self.build(file_path:, json:, verbose:)
  new(file_path: file_path, json: json, verbose: verbose).build
end

Instance Method Details

#buildObject



33
34
35
36
37
38
39
# File 'lib/code_ownership/private/for_file_output_builder.rb', line 33

def build
  result_hash = @verbose ? build_verbose : build_terse

  return result_hash.to_json if @json

  build_message_for(result_hash)
end