Class: ClassMetrix::Formatters::Components::FooterComponent

Inherits:
Object
  • Object
show all
Defined in:
lib/class_metrix/formatters/components/footer_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ FooterComponent

Returns a new instance of FooterComponent.



7
8
9
10
11
12
13
14
# File 'lib/class_metrix/formatters/components/footer_component.rb', line 7

def initialize(options = {})
  @options = options
  @show_footer = options.fetch(:show_footer, true)
  @custom_footer = options[:custom_footer]
  @show_timestamp = options.fetch(:show_timestamp, false)
  @show_separator = options.fetch(:show_separator, true)
  @footer_style = options.fetch(:footer_style, :default) # :default, :minimal, :detailed
end

Instance Method Details

#generateObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/class_metrix/formatters/components/footer_component.rb', line 16

def generate
  return [] unless @show_footer

  output = [] # : Array[String]

  # Add separator line
  output << "---" if @show_separator

  case @footer_style
  when :minimal
    output << "*Generated by ClassMetrix*"
  when :detailed
    output.concat(generate_detailed_footer)
  else
    output.concat(generate_default_footer)
  end

  output
end