Class: TILE::T::Tile

Inherits:
Object
  • Object
show all
Defined in:
lib/toychest/tile.rb

Instance Method Summary collapse

Constructor Details

#initialize(k, t) ⇒ Tile

Returns a new instance of Tile.



15
16
17
18
# File 'lib/toychest/tile.rb', line 15

def initialize k, t
	@id, @tile = k, t
	@h = {}
end

Instance Method Details

#[](k) ⇒ Object



22
23
24
# File 'lib/toychest/tile.rb', line 22

def [] k
	@h[k]
end

#[]=(k, v) ⇒ Object



19
20
21
# File 'lib/toychest/tile.rb', line 19

def []= k,v
	@h[k] = v
end

#on(k, h = {}, &b) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/toychest/tile.rb', line 25

def on k, h={}, &b
	if block_given?
		@on[k] = b
	else
		@on[k].call(h)
	end
end