class Rollio::TableSet

The data store for all of the registered tables

Attributes

registry[R]
tables[R]

Public Class Methods

new(registry:) click to toggle source
# File lib/rollio/table_set.rb, line 7
def initialize(registry:)
  @registry = registry
  @tables = {}
end

Public Instance Methods

add(key, label: key, &block) click to toggle source
# File lib/rollio/table_set.rb, line 27
def add(key, label: key, &block)
  tables[key] = Table.new(table_set: self, key: key, label: label, &block)
end
render(table: nil, debug: false) click to toggle source
# File lib/rollio/table_set.rb, line 31
def render(table: nil, debug: false)
  puts "Table Set { object_id: #{object_id} }\n" if debug
  if table
    tables.fetch(table).render
  else
    tables.sort { |a,b| a[0] <=> b[0] }.each do |key, table|
      table.render
    end
  end
  nil
end
roll_on(table_name, **kwargs) click to toggle source
# File lib/rollio/table_set.rb, line 22
def roll_on(table_name, **kwargs)
  table = tables.fetch(table_name)
  table.roll!(**kwargs)
end
table_names() click to toggle source
# File lib/rollio/table_set.rb, line 18
def table_names
  tables.keys.sort
end