Class: Fitting::Report::Prefix

Inherits:
Object
  • Object
show all
Defined in:
lib/fitting/report/prefix.rb

Constant Summary collapse

KEYS =
{
  'openapi2' => :openapi2_json_path,
  'openapi3' => :openapi3_yaml_path,
  'drafter' => :drafter_yaml_path,
  'crafter' => :crafter_yaml_path,
  'tomogram' => :tomogram_json_path
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema_paths: nil, type: nil, name: '', skip: false, only: []) ⇒ Prefix

Returns a new instance of Prefix.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fitting/report/prefix.rb', line 16

def initialize(schema_paths: nil, type: nil, name: '', skip: false, only: [])
  @name = name
  @cover = false

  @actions = Fitting::Report::Actions.new([])
  return if skip

  schema_paths.each do |path|
    tomogram = Tomograph::Tomogram.new(prefix: name, KEYS[type] => path)

    tomogram.to_a.filter! { |action| only.include?("#{action.method} #{action.path}") } if only.present?

    @actions.push(Fitting::Report::Actions.new(tomogram))
  end
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



14
15
16
# File 'lib/fitting/report/prefix.rb', line 14

def actions
  @actions
end

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/fitting/report/prefix.rb', line 14

def name
  @name
end

Instance Method Details

#cover!Object



32
33
34
# File 'lib/fitting/report/prefix.rb', line 32

def cover!
  @cover = true
end

#cover?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/fitting/report/prefix.rb', line 36

def cover?
  @cover
end