Class: Arpa::Entities::Role

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Role

Returns a new instance of Role.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/arpa/entities/role.rb', line 7

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

  @id          = attrs[:id]
  @name        = attrs[:name]
  @description = attrs[:description]
  @action_ids  = default_value_to_nil_or_empty(attrs[:action_ids], [])
  @actions     = default_value_to_nil_or_empty(attrs[:actions], [])
  @profiles    = default_value_to_nil_or_empty(attrs[:profiles], [])
  @created_at  = attrs[:created_at]
  @updated_at  = attrs[:updated_at]
  @removed     = default_value_to_nil_or_empty(attrs[:removed], false)
end

Instance Attribute Details

#action_idsObject (readonly)

Returns the value of attribute action_ids.



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

def action_ids
  @action_ids
end

#actionsObject (readonly)

Returns the value of attribute actions.



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

def actions
  @actions
end

#created_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#profilesObject (readonly)

Returns the value of attribute profiles.



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

def profiles
  @profiles
end

#removedObject (readonly)

Returns the value of attribute removed.



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

def removed
  @removed
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

Instance Method Details

#has_profile?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/arpa/entities/role.rb', line 21

def has_profile?
  profiles.present?
end