Class: Tablescript::TableEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/tablescript/table_entry.rb

Overview

TableEntry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, roll, blk) ⇒ TableEntry

Returns a new instance of TableEntry.



25
26
27
28
29
# File 'lib/tablescript/table_entry.rb', line 25

def initialize(id, roll, blk)
  @id = id
  @roll = roll
  @blk = blk
end

Instance Attribute Details

#blkObject (readonly)

Returns the value of attribute blk.



23
24
25
# File 'lib/tablescript/table_entry.rb', line 23

def blk
  @blk
end

#idObject (readonly)

Returns the value of attribute id.



23
24
25
# File 'lib/tablescript/table_entry.rb', line 23

def id
  @id
end

#rollObject (readonly)

Returns the value of attribute roll.



23
24
25
# File 'lib/tablescript/table_entry.rb', line 23

def roll
  @roll
end

Instance Method Details

#evaluate(roll, table) ⇒ Object



31
32
33
# File 'lib/tablescript/table_entry.rb', line 31

def evaluate(roll, table)
  table.instance_exec(RollContext.new(roll, table, self), &@blk)
end