Class: Dina::ProtocolData
- Inherits:
-
Object
- Object
- Dina::ProtocolData
- Defined in:
- lib/dina/components/protocol_data.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#protocolDataElement ⇒ Object
array.
-
#vocabularyBased ⇒ Object
boolean.
Instance Method Summary collapse
- #add_data_element(element:) ⇒ Object
-
#initialize ⇒ ProtocolData
constructor
A new instance of ProtocolData.
-
#to_hash ⇒ Object
Produce a hash with symbolized keys.
Constructor Details
#initialize ⇒ ProtocolData
Returns a new instance of ProtocolData.
7 8 9 |
# File 'lib/dina/components/protocol_data.rb', line 7 def initialize @protocolDataElement = [] end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
3 4 5 |
# File 'lib/dina/components/protocol_data.rb', line 3 def key @key end |
#protocolDataElement ⇒ Object
array
5 6 7 |
# File 'lib/dina/components/protocol_data.rb', line 5 def protocolDataElement @protocolDataElement end |
#vocabularyBased ⇒ Object
boolean
4 5 6 |
# File 'lib/dina/components/protocol_data.rb', line 4 def vocabularyBased @vocabularyBased end |
Instance Method Details
#add_data_element(element:) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/dina/components/protocol_data.rb', line 11 def add_data_element(element:) if !element.instance_of?(ProtocolDataElement) raise PropertyValueInvalid, "Data Element must be a ProtocolDataElement." end @protocolDataElement << element.to_hash end |
#to_hash ⇒ Object
Produce a hash with symbolized keys
19 20 21 22 23 |
# File 'lib/dina/components/protocol_data.rb', line 19 def to_hash hash = {} instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) } hash.deep_symbolize_keys end |