Class: TPPlus::Nodes::HeaderNode

Inherits:
BaseNode
  • Object
show all
Defined in:
lib/tp_plus/nodes/header_node.rb

Instance Method Summary collapse

Methods inherited from BaseNode

#can_be_inlined?

Constructor Details

#initialize(type, value) ⇒ HeaderNode

Returns a new instance of HeaderNode.



4
5
6
7
# File 'lib/tp_plus/nodes/header_node.rb', line 4

def initialize(type, value)
  @type  = type
  @value = value
end

Instance Method Details

#eval(context, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/tp_plus/nodes/header_node.rb', line 9

def eval(context, options={})
  case @type
  when "TP_IGNORE_PAUSE"
    context.header_data[:ignore_pause] = @value
  when "TP_COMMENT"
    context.header_data[:comment] = @value
  when "TP_GROUPMASK"
    context.header_data[:group_mask] = @value
  when "TP_SUBTYPE"
    context.header_data[:subtype] = @value.to_sym
  else
    raise "Unsupported TP Header value (#{@type})"
  end

  nil
end