Class: Utopia::Controller::Action
- Inherits:
-
Hash
- Object
- Hash
- Utopia::Controller::Action
- Defined in:
- lib/utopia/controller/action.rb
Instance Attribute Summary collapse
-
#callback ⇒ Object
Returns the value of attribute callback.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #callback? ⇒ Boolean
- #define(path, options = {}, &callback) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
- #indirect? ⇒ Boolean
- #inspect ⇒ Object
- #invoke!(controller, *arguments) ⇒ Object
-
#select(relative_path) ⇒ Object
relative_path = 2014/mr-potato actions => => A.
Instance Attribute Details
#callback ⇒ Object
Returns the value of attribute callback.
24 25 26 |
# File 'lib/utopia/controller/action.rb', line 24 def callback @callback end |
#options ⇒ Object
Returns the value of attribute options.
25 26 27 |
# File 'lib/utopia/controller/action.rb', line 25 def end |
Instance Method Details
#==(other) ⇒ Object
43 44 45 |
# File 'lib/utopia/controller/action.rb', line 43 def == other super and (self.callback == other.callback) and (self. == other.) end |
#callback? ⇒ Boolean
27 28 29 |
# File 'lib/utopia/controller/action.rb', line 27 def callback? @callback != nil end |
#define(path, options = {}, &callback) ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/utopia/controller/action.rb', line 86 def define(path, = {}, &callback) current = self path.reverse.each do |name| current = (current[name.to_sym] ||= Action.new) end current. = current.callback = callback return current end |
#eql?(other) ⇒ Boolean
35 36 37 |
# File 'lib/utopia/controller/action.rb', line 35 def eql? other super and self.callback.eql? other.callback and self..eql? other. end |
#hash ⇒ Object
39 40 41 |
# File 'lib/utopia/controller/action.rb', line 39 def hash [super, callback, ].hash end |
#indirect? ⇒ Boolean
31 32 33 |
# File 'lib/utopia/controller/action.rb', line 31 def indirect? [:indirect] end |
#inspect ⇒ Object
103 104 105 106 107 108 109 |
# File 'lib/utopia/controller/action.rb', line 103 def inspect if callback? "<action " + super + ":#{callback.source_location}(#{options})>" else "<action " + super + ">" end end |
#invoke!(controller, *arguments) ⇒ Object
99 100 101 |
# File 'lib/utopia/controller/action.rb', line 99 def invoke!(controller, *arguments) controller.instance_exec(*arguments, &@callback) end |
#select(relative_path) ⇒ Object
relative_path = 2014/mr-potato actions => => A
78 79 80 81 82 83 84 |
# File 'lib/utopia/controller/action.rb', line 78 def select(relative_path) actions = [] append(relative_path.reverse, 0, actions) return actions end |