Class: EntityActionController

Inherits:
Object
  • Object
show all
Defined in:
lib/rbbt/rest/entity/action_controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#actionsObject

Returns the value of attribute actions.



3
4
5
# File 'lib/rbbt/rest/entity/action_controller.rb', line 3

def actions
  @actions
end

#entityObject

Returns the value of attribute entity.



2
3
4
# File 'lib/rbbt/rest/entity/action_controller.rb', line 2

def entity
  @entity
end

#idObject

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