Class: TL1::OutputFormat

Inherits:
Object
  • Object
show all
Defined in:
lib/tl1/output_format.rb

Overview

A format for records appearing in output messages.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ OutputFormat

Returns a new instance of OutputFormat.



7
8
9
# File 'lib/tl1/output_format.rb', line 7

def initialize(source)
  @source = source
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



5
6
7
# File 'lib/tl1/output_format.rb', line 5

def source
  @source
end

Instance Method Details

#as_jsonObject



15
16
17
# File 'lib/tl1/output_format.rb', line 15

def as_json
  ast.as_json
end

#astObject



11
12
13
# File 'lib/tl1/output_format.rb', line 11

def ast
  @ast ||= AST.parse_message_format(source)
end

#parse(record_source) ⇒ Object



19
20
21
# File 'lib/tl1/output_format.rb', line 19

def parse(record_source)
  ast.parse(record_source)
end