Sha256: ccf8390b885314307e5a2a614fb177cc231f25771155c515bf04b36eee3f4b97
Contents?: true
Size: 1000 Bytes
Versions: 4
Compression:
Stored size: 1000 Bytes
Contents
module Arpa module Entities class Role attr_reader :id, :name, :description, :created_at, :updated_at, :removed, :action_ids, :actions, :profiles 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 def has_profile? profiles.present? end private def default_value_to_nil_or_empty(attr_value, default_value) return attr_value if attr_value.present? default_value end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
arpa-0.2.0 | lib/arpa/entities/role.rb |
arpa-0.1.0 | lib/arpa/entities/role.rb |
arpa-0.0.9 | lib/arpa/entities/role.rb |
arpa-0.0.8 | lib/arpa/entities/role.rb |