Class: Dina::AgentRole
- Inherits:
-
Object
- Object
- Dina::AgentRole
- Defined in:
- lib/dina/components/agent_role.rb
Instance Attribute Summary collapse
-
#agent ⇒ Object
An array of known UUIDs for a Person.
-
#date ⇒ Object
Returns the value of attribute date.
-
#remarks ⇒ Object
Returns the value of attribute remarks.
-
#roles ⇒ Object
An array of roles: Owner, Borrower, Prepared By.
Instance Method Summary collapse
- #add_agent(id:) ⇒ Object
- #add_role(role:) ⇒ Object
-
#initialize ⇒ AgentRole
constructor
A new instance of AgentRole.
- #to_hash ⇒ Object
Constructor Details
#initialize ⇒ AgentRole
Returns a new instance of AgentRole.
8 9 10 11 |
# File 'lib/dina/components/agent_role.rb', line 8 def initialize @agent = [] @roles = [] end |
Instance Attribute Details
#agent ⇒ Object
An array of known UUIDs for a Person
3 4 5 |
# File 'lib/dina/components/agent_role.rb', line 3 def agent @agent end |
#date ⇒ Object
Returns the value of attribute date.
5 6 7 |
# File 'lib/dina/components/agent_role.rb', line 5 def date @date end |
#remarks ⇒ Object
Returns the value of attribute remarks.
6 7 8 |
# File 'lib/dina/components/agent_role.rb', line 6 def remarks @remarks end |
#roles ⇒ Object
An array of roles: Owner, Borrower, Prepared By
4 5 6 |
# File 'lib/dina/components/agent_role.rb', line 4 def roles @roles end |
Instance Method Details
#add_agent(id:) ⇒ Object
13 14 15 16 |
# File 'lib/dina/components/agent_role.rb', line 13 def add_agent(id:) raise PropertyValueInvalid, "Agent must be a UUID." if !id.is_uuid? @agent << id end |
#add_role(role:) ⇒ Object
18 19 20 |
# File 'lib/dina/components/agent_role.rb', line 18 def add_role(role:) @roles << role end |
#to_hash ⇒ Object
22 23 24 25 26 |
# File 'lib/dina/components/agent_role.rb', line 22 def to_hash hash = {} instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) } hash.deep_symbolize_keys end |