class Rollio::Registry

Responsible for registering random tables and exposing a means of rolling on those tables.

Attributes

table_set[RW]

Public Class Methods

new(&block) click to toggle source

@api public

# File lib/rollio/registry.rb, line 9
def initialize(&block)
  self.table_set = TableSet.new(registry: self)
  instance_exec(self, &block) if block_given?
end

Public Instance Methods

roll_on(key, **kwargs) click to toggle source

@api private @param key [String] The key of the table you want to roll on @see Registry::Table#key for details @todo Consider adding a modifier (eg. `roll_on(key, with: -2)`)

# File lib/rollio/registry.rb, line 21
def roll_on(key, **kwargs)
  table_set.roll_on(key, **kwargs)
end
table(*args, &block) click to toggle source

@api private The exposed method for adding a table to the registry

# File lib/rollio/registry.rb, line 27
def table(*args, &block)
  table_set.add(*args, &block)
end