class TL1::AST::Variable
A variable string. Included in parsing output.
Public Class Methods
new(fields)
click to toggle source
# File lib/tl1/ast.rb, line 245 def initialize(fields) @fields = fields end
optional_variable(token)
click to toggle source
# File lib/tl1/ast.rb, line 241 def self.optional_variable(token) token.match(/\A<(.*)>\z/) { |m| m[1].to_sym } || token.to_sym end
parse(source)
click to toggle source
# File lib/tl1/ast.rb, line 237 def self.parse(source) new(optional_variable(source)) end
Public Instance Methods
format(**kwargs)
click to toggle source
# File lib/tl1/ast.rb, line 249 def format(**kwargs) kwargs[@fields] end
parse(fragment, record:)
click to toggle source
# File lib/tl1/ast.rb, line 253 def parse(fragment, record:) record[fields] = AST.remove_quotes(fragment) end