Class: Canis::Utils::MapNode
- Defined in:
- lib/canis/core/widgets/rwidget.rb
Overview
# this allows us to play a bit with the map, and allocate one action to another key # get_action_map() = get_action(32) # But we will hold on this unless absolutely necessary. 2014-05-12 - 22:36 CANIS.
def get_action keycode
@_key_map[keycode]
end
def get_action_map
@_key_map
end
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#fetch(key, deft = nil) ⇒ Object
fetch / get returns a node, or nil.
-
#initialize(arg = nil) ⇒ MapNode
constructor
A new instance of MapNode.
- #put(key, value) ⇒ Object
Constructor Details
#initialize(arg = nil) ⇒ MapNode
Returns a new instance of MapNode.
517 518 519 |
# File 'lib/canis/core/widgets/rwidget.rb', line 517 def initialize arg=nil @map = Hash.new {|hash, key| hash[key] = MapNode.new } end |
Instance Attribute Details
#action ⇒ Object
515 516 517 |
# File 'lib/canis/core/widgets/rwidget.rb', line 515 def action @action end |
Instance Method Details
#fetch(key, deft = nil) ⇒ Object
fetch / get returns a node, or nil. if node, then use node.action
524 525 526 |
# File 'lib/canis/core/widgets/rwidget.rb', line 524 def fetch key, deft=nil @map.fetch(key, deft) end |
#put(key, value) ⇒ Object
520 521 522 |
# File 'lib/canis/core/widgets/rwidget.rb', line 520 def put key, value @map[key].action = value end |