Class: Agent::SessionContext::InjectedContext

Inherits:
Data
  • Object
show all
Defined in:
lib/agent/session_context/injected_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind:, bytes:, occurrences:, source_refs:, text: nil) ⇒ InjectedContext

Returns a new instance of InjectedContext.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/agent/session_context/injected_context.rb', line 6

def initialize(kind:, bytes:, occurrences:, source_refs:, text: nil)
  normalized_kind = normalize_symbol(kind, :kind)
  normalized_bytes = normalize_nonnegative_integer(bytes, :bytes)
  normalized_occurrences = normalize_positive_integer(occurrences, :occurrences)
  normalized_source_refs = normalize_source_refs(source_refs)
  normalized_text = normalize_optional_string(text, :text)
  validate_consistency!(
    bytes: normalized_bytes,
    occurrences: normalized_occurrences,
    source_refs: normalized_source_refs,
    text: normalized_text
  )

  super(
    kind: normalized_kind,
    bytes: normalized_bytes,
    occurrences: normalized_occurrences,
    source_refs: normalized_source_refs,
    text: normalized_text
  )
end

Instance Attribute Details

#bytes ⇒ Object (readonly)

Returns the value of attribute bytes

Returns:

  • (Object) —

    the current value of bytes



5
6
7
# File 'lib/agent/session_context/injected_context.rb', line 5

def bytes
  @bytes
end

#kind ⇒ Object (readonly)

Returns the value of attribute kind

Returns:

  • (Object) —

    the current value of kind



5
6
7
# File 'lib/agent/session_context/injected_context.rb', line 5

def kind
  @kind
end

#occurrences ⇒ Object (readonly)

Returns the value of attribute occurrences

Returns:

  • (Object) —

    the current value of occurrences



5
6
7
# File 'lib/agent/session_context/injected_context.rb', line 5

def occurrences
  @occurrences
end

#source_refs ⇒ Object (readonly)

Returns the value of attribute source_refs

Returns:

  • (Object) —

    the current value of source_refs



5
6
7
# File 'lib/agent/session_context/injected_context.rb', line 5

def source_refs
  @source_refs
end

#text ⇒ Object (readonly)

Returns the value of attribute text

Returns:

  • (Object) —

    the current value of text



5
6
7
# File 'lib/agent/session_context/injected_context.rb', line 5

def text
  @text
end