Class: EntityActionController
- Inherits:
-
Object
- Object
- EntityActionController
- Defined in:
- lib/rbbt/rest/entity/action_controller.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#entity ⇒ Object
Returns the value of attribute entity.
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
- #add(action, text = nil, resource = nil, params = {}) ⇒ Object
-
#initialize(entity, id = nil) ⇒ EntityActionController
constructor
A new instance of EntityActionController.
Constructor Details
#initialize(entity, id = nil) ⇒ EntityActionController
Returns a new instance of EntityActionController.
5 6 7 8 |
# File 'lib/rbbt/rest/entity/action_controller.rb', line 5 def initialize(entity, id = nil) @entity, @id = entity, id @actions = [] end |
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
3 4 5 |
# File 'lib/rbbt/rest/entity/action_controller.rb', line 3 def actions @actions end |
#entity ⇒ Object
Returns the value of attribute entity.
2 3 4 |
# File 'lib/rbbt/rest/entity/action_controller.rb', line 2 def entity @entity end |
#id ⇒ Object
Returns the value of attribute id.
2 3 4 |
# File 'lib/rbbt/rest/entity/action_controller.rb', line 2 def id @id end |
Instance Method Details
#add(action, text = nil, resource = nil, params = {}) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/rbbt/rest/entity/action_controller.rb', line 10 def add(action, text = nil, resource = nil, params = {}) text = action if text.nil? resource = action.respond_to?(:resource) ? action.resource : nil resource ||= "Rbbt" @actions << [action, text, resource, params] end |