Class: Foxtail::Bundle::Parser::AST::Term

Inherits:
Data
  • Object
show all
Defined in:
lib/foxtail/bundle/parser/ast.rb,
lib/foxtail/bundle/parser/ast.rb

Overview

Term entry in fluent-bundle compatible format

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, value:, attributes: nil) ⇒ Term

Returns a new instance of Term.

Parameters:

  • id (#to_s)

    The term identifier (- prefix will be added if missing)

  • value

    The term pattern

  • attributes (Hash, nil) (defaults to: nil)

    Term attributes (default: nil)



123
124
125
126
127
# File 'lib/foxtail/bundle/parser/ast.rb', line 123

def initialize(id:, value:, attributes: nil)
  term_id = id.to_s
  term_id = "-#{term_id}" unless term_id.start_with?("-")
  super(id: term_id, value:, attributes:)
end

Instance Attribute Details

#attributesObject (readonly)

Hash, nil

Term attributes



119
120
121
# File 'lib/foxtail/bundle/parser/ast.rb', line 119

def attributes
  @attributes
end

#idObject (readonly)

String

The term identifier (with - prefix)



119
120
121
# File 'lib/foxtail/bundle/parser/ast.rb', line 119

def id
  @id
end

#valueObject (readonly)

The term pattern (String or Array)



119
120
121
# File 'lib/foxtail/bundle/parser/ast.rb', line 119

def value
  @value
end