Class: Fitting::Doc::CombinationStep

Inherits:
Step
  • Object
show all
Defined in:
lib/fitting/doc/combination_step.rb

Defined Under Namespace

Classes: NotFound

Instance Attribute Summary collapse

Attributes inherited from Step

#index_after, #index_before, #index_medium, #next_steps, #res_after, #res_before, #res_medium, #step_cover_size, #step_key

Instance Method Summary collapse

Methods inherited from Step

#index_offset, #mark_enum, #mark_range, #mark_required, #new_index_offset, #next, #nocover!, #range, #report, #to_hash, #valid?

Constructor Details

#initialize(json_schema, type, combination, source_json_schema) ⇒ CombinationStep

Returns a new instance of CombinationStep.



10
11
12
13
14
15
16
17
18
19
# File 'lib/fitting/doc/combination_step.rb', line 10

def initialize(json_schema, type, combination, source_json_schema)
  @logs = []
  @step_cover_size = 0
  @json_schema = json_schema
  @next_steps = []
  @type = type
  @step_key = combination
  @source_json_schema = source_json_schema
  initialize_combinations(combination, json_schema)
end

Instance Attribute Details

#json_schemaObject

Returns the value of attribute json_schema.



8
9
10
# File 'lib/fitting/doc/combination_step.rb', line 8

def json_schema
  @json_schema
end

#logsObject

Returns the value of attribute logs.



8
9
10
# File 'lib/fitting/doc/combination_step.rb', line 8

def logs
  @logs
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/fitting/doc/combination_step.rb', line 8

def type
  @type
end

Instance Method Details

#debug_report(index) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fitting/doc/combination_step.rb', line 24

def debug_report(index)
  combinations = []
  @next_steps.each do |next_step|
    combinations.push(
      next_step.debug_report(index)
    )
  end
  return {} if index.nil? || index_before.nil?
  {
    "combination type" => @type,
    "combination" => @step_key,
    "json_schema" => @json_schema,
    "valid_jsons" => @logs,
    "index_before" => @index_before - index,
    "index_medium" => @index_medium - index,
    "index_after" => @index_after - index,
    "res_before" => @res_before.map { |r| r ? r : "null" }[index..-1],
    "res_medium" => @res_medium.map { |r| r ? r : "null" }[index..-1],
    "res_after" => @res_after.map { |r| r ? r : "null" }[index..-1],
    "combinations" => combinations
  }
end

#initialize_combinations(combination, json_schema) ⇒ Object



21
22
# File 'lib/fitting/doc/combination_step.rb', line 21

def initialize_combinations(combination, json_schema)
end