Class: Agent::SessionContext::Item
- Inherits:
-
Data
- Object
- Data
- Agent::SessionContext::Item
- Defined in:
- lib/agent/session_context/item.rb
Constant Summary collapse
- EVIDENCE_VALUES =
%i[observed explicit inferred].freeze
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#evidence ⇒ Object
readonly
Returns the value of attribute evidence.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#source_refs ⇒ Object
readonly
Returns the value of attribute source_refs.
Instance Method Summary collapse
-
#initialize(kind:, label:, evidence:, source_refs:, detail: nil, attributes: {}) ⇒ Item
constructor
A new instance of Item.
Constructor Details
#initialize(kind:, label:, evidence:, source_refs:, detail: nil, attributes: {}) ⇒ Item
Returns a new instance of Item.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/agent/session_context/item.rb', line 8 def initialize(kind:, label:, evidence:, source_refs:, detail: nil, attributes: {}) unless EVIDENCE_VALUES.include?(evidence) raise ArgumentError, "evidence must be one of: #{EVIDENCE_VALUES.join(", ")}" end super( kind: kind.to_sym, label: normalize_string(label, :label), detail: normalize_optional_string(detail, :detail), evidence: evidence, source_refs: ImmutableValue.copy(Array(source_refs)), attributes: normalize_attributes(attributes) ) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes
5 6 7 |
# File 'lib/agent/session_context/item.rb', line 5 def attributes @attributes end |
#detail ⇒ Object (readonly)
Returns the value of attribute detail
5 6 7 |
# File 'lib/agent/session_context/item.rb', line 5 def detail @detail end |
#evidence ⇒ Object (readonly)
Returns the value of attribute evidence
5 6 7 |
# File 'lib/agent/session_context/item.rb', line 5 def evidence @evidence end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind
5 6 7 |
# File 'lib/agent/session_context/item.rb', line 5 def kind @kind end |
#label ⇒ Object (readonly)
Returns the value of attribute label
5 6 7 |
# File 'lib/agent/session_context/item.rb', line 5 def label @label end |
#source_refs ⇒ Object (readonly)
Returns the value of attribute source_refs
5 6 7 |
# File 'lib/agent/session_context/item.rb', line 5 def source_refs @source_refs end |