Module: MrT::ActionRegistry

Defined in:
lib/mrT/selector.rb

Defined Under Namespace

Classes: ActionSelector

Instance Method Summary (collapse)

Instance Method Details

- (Object) action(name, desc = nil, guard = lambda { |n| true }, &action)



174
175
176
177
178
179
# File 'lib/mrT/selector.rb', line 174

def action(name, desc = nil, guard = lambda { |n| true }, &action)
  me = self
  cls = Action.with(name, desc, action, guard)
  cls.define_singleton_method(:inherited) { |sub| me.actions << sub }
  action && Class.new(cls) || cls
end

- (Object) actions



170
171
172
# File 'lib/mrT/selector.rb', line 170

def actions
  @actions ||= []
end