Class: Crystalball::Rails::TablesMap

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/crystalball/rails/tables_map.rb

Overview

Storage for tables map

Defined Under Namespace

Classes: Metadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata: {}, example_groups: {}) ⇒ TablesMap

Returns a new instance of TablesMap.

Parameters:

  • metadata (Hash) (defaults to: {})
    • add or override metadata of execution map

  • example_groups (Hash) (defaults to: {})
    • initial list of tables



32
33
34
35
# File 'lib/crystalball/rails/tables_map.rb', line 32

def initialize(metadata: {}, example_groups: {})
  @metadata = Metadata.new(**)
  @example_groups = example_groups
end

Instance Attribute Details

#example_groupsObject

Returns the value of attribute example_groups.



25
26
27
# File 'lib/crystalball/rails/tables_map.rb', line 25

def example_groups
  @example_groups
end

#metadataObject

Returns the value of attribute metadata.



25
26
27
# File 'lib/crystalball/rails/tables_map.rb', line 25

def 
  @metadata
end

Instance Method Details

#add(files:, for_table:) ⇒ Object



42
43
44
45
46
# File 'lib/crystalball/rails/tables_map.rb', line 42

def add(files:, for_table:)
  example_groups[for_table] ||= []
  example_groups[for_table] += files
  example_groups[for_table].uniq!
end

#clear!Object

Remove all example_groups



38
39
40
# File 'lib/crystalball/rails/tables_map.rb', line 38

def clear!
  self.example_groups = {}
end