Class: BCDice::DiceTable::D66HalfGridTable

Inherits:
D66GridTable show all
Defined in:
lib/bcdice/dice_table/d66_half_grid_table.rb

Overview

D66を振って6x6マスの表を参照する

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from D66GridTable

#roll

Constructor Details

#initialize(name, items_1_2_3, items_4_5_6) ⇒ D66HalfGridTable

Returns a new instance of D66HalfGridTable.

Parameters:

  • name (String)

    表の名前

  • items_1_2_3 (Array<String>)
  • items_4_5_6 (Array<String>)


20
21
22
23
24
25
26
27
28
29
30
# File 'lib/bcdice/dice_table/d66_half_grid_table.rb', line 20

def initialize(name, items_1_2_3, items_4_5_6)
  @name = name
  @items = [
    items_1_2_3,
    items_1_2_3,
    items_1_2_3,
    items_4_5_6,
    items_4_5_6,
    items_4_5_6,
  ].freeze
end

Class Method Details

.from_i18n(key, locale) ⇒ D66HalfGridTable

Parameters:

  • key (String)
  • locale (Symbol)

Returns:



12
13
14
15
# File 'lib/bcdice/dice_table/d66_half_grid_table.rb', line 12

def self.from_i18n(key, locale)
  table = I18n.t(key, locale: locale, raise: true)
  new(table[:name], table[:items_1_2_3], table[:items_4_5_6])
end