Class: Rulz::Action
- Inherits:
-
Object
- Object
- Rulz::Action
- Defined in:
- lib/rulz/action.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#proc ⇒ Object
Returns the value of attribute proc.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, klass, proc) ⇒ Action
constructor
A new instance of Action.
Constructor Details
#initialize(name, klass, proc) ⇒ Action
Returns a new instance of Action.
5 6 7 8 9 10 11 12 |
# File 'lib/rulz/action.rb', line 5 def initialize(name, klass, proc) @name = name @proc = proc klass.instance_exec self do |action| @rulz_actions ||= [] @rulz_actions << action end end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/rulz/action.rb', line 3 def name @name end |
#proc ⇒ Object
Returns the value of attribute proc.
3 4 5 |
# File 'lib/rulz/action.rb', line 3 def proc @proc end |
Class Method Details
.find(klass, name) ⇒ Object
14 15 16 |
# File 'lib/rulz/action.rb', line 14 def self.find(klass, name) klass.instance_variable_get(:@rulz_actions).find {|c| c.name == name } end |