Class: Loom::Mods::ActionProxy::ActionMap

Inherits:
Object
  • Object
show all
Defined in:
lib/loom/mods/action_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeActionMap

Returns a new instance of ActionMap.



84
85
86
87
# File 'lib/loom/mods/action_proxy.rb', line 84

def initialize
  @action_tuples = []
  @ns_actionmaps = {}
end

Instance Attribute Details

#action_tuplesObject (readonly)

Returns the value of attribute action_tuples.



82
83
84
# File 'lib/loom/mods/action_proxy.rb', line 82

def action_tuples
  @action_tuples
end

#ns_actionmapsObject (readonly)

Returns the value of attribute ns_actionmaps.



82
83
84
# File 'lib/loom/mods/action_proxy.rb', line 82

def ns_actionmaps
  @ns_actionmaps
end

Instance Method Details

#add_action(action_name, bound_method_name, namespace = nil) ⇒ Object



89
90
91
92
93
94
95
96
97
# File 'lib/loom/mods/action_proxy.rb', line 89

def add_action(action_name, bound_method_name, namespace=nil)
  if namespace.nil?
    tuple = [action_name, bound_method_name]
    @action_tuples << tuple unless namespace
  else
    # Adds an action name to a nested ActionMap
    add_namespace(namespace).add_action action_name, bound_method_name
  end
end