Class: SymbolComponent

Inherits:
Object
  • Object
show all
Defined in:
lib/delve/component/symbol.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent, symbol, color = :white) ⇒ SymbolComponent

Returns a new instance of SymbolComponent.



2
3
4
5
6
7
8
9
# File 'lib/delve/component/symbol.rb', line 2

def initialize(parent, symbol, color=:white)
  raise 'Cannot create symbol component when parent is nil' unless parent
  raise 'Cannot create symbol component when symbol is nil' unless symbol

  @parent = parent
  @symbol = symbol
  @color = color
end

Instance Method Details

#idObject



11
12
13
# File 'lib/delve/component/symbol.rb', line 11

def id
  :symbol
end

#symbolObject



20
21
22
# File 'lib/delve/component/symbol.rb', line 20

def symbol
  { :char => @symbol, :color => @color }
end

#update(symbol, color = :white) ⇒ Object



15
16
17
18
# File 'lib/delve/component/symbol.rb', line 15

def update(symbol, color=:white)
  @symbol = symbol
  @color = color
end