Class: Synthra::Parser::AST::HeaderDirective

Inherits:
DirectiveNode show all
Defined in:
lib/synthra/parser/ast.rb

Overview

Header directive

Sets a custom HTTP header for the response.

Examples:

DSL

@header Content-Type: application/json
@header X-Custom: value

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, value:, line: nil) ⇒ HeaderDirective

Create a new HeaderDirective

Parameters:

  • key (String)

    header name

  • value (String)

    header value

  • line (Integer, nil) (defaults to: nil)

    source line number



1249
1250
1251
1252
1253
# File 'lib/synthra/parser/ast.rb', line 1249

def initialize(key:, value:, line: nil)
  super(line: line)
  @key = key
  @value = value
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



1234
1235
1236
# File 'lib/synthra/parser/ast.rb', line 1234

def key
  @key
end

#valueObject (readonly)

Returns the value of attribute value.



1240
1241
1242
# File 'lib/synthra/parser/ast.rb', line 1240

def value
  @value
end