Class: Arpa::Entities::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/arpa/entities/action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Action

Returns a new instance of Action.



6
7
8
9
10
11
12
13
14
15
# File 'lib/arpa/entities/action.rb', line 6

def initialize(attrs = {})
  attrs = attrs.with_indifferent_access

  @id          = attrs[:id]
  @resource_id = attrs[:resource_id]
  @resource    = attrs[:resource]
  @name        = attrs[:name]
  @created_at  = attrs[:created_at]
  @updated_at  = attrs[:updated_at]
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



4
5
6
# File 'lib/arpa/entities/action.rb', line 4

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/arpa/entities/action.rb', line 4

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/arpa/entities/action.rb', line 4

def name
  @name
end

#resourceObject (readonly)

Returns the value of attribute resource.



4
5
6
# File 'lib/arpa/entities/action.rb', line 4

def resource
  @resource
end

#resource_idObject (readonly)

Returns the value of attribute resource_id.



4
5
6
# File 'lib/arpa/entities/action.rb', line 4

def resource_id
  @resource_id
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



4
5
6
# File 'lib/arpa/entities/action.rb', line 4

def updated_at
  @updated_at
end

Instance Method Details

#descriptionObject



22
23
24
# File 'lib/arpa/entities/action.rb', line 22

def description
  I18n.t(name.to_sym, scope: "entities.resources.#{resource_name}.actions.description")
end

#resource_nameObject



17
18
19
20
# File 'lib/arpa/entities/action.rb', line 17

def resource_name
  return resource.name if resource
  ''
end