class BELParser::Script::State::BELVersion
Constants
- DEFAULT_BEL_VERSION
- TARGET_NODE
AST
node representing a document property (e.g. +SET DOCUMENT …+).
Public Class Methods
consume(ast_node, script_context)
click to toggle source
# File lib/bel_parser/script/state/bel_version.rb, line 17 def self.consume(ast_node, script_context) return unless ast_node.is_a?(TARGET_NODE) name, value = ast_node.children name_string = name.identifier.string_literal return unless is_bel_version?(name_string) value_string = value.children[0].string_literal begin spec = BELParser::Language.specification(value_string) rescue ArgumentError spec = BELParser::Language.specification(DEFAULT_BEL_VERSION) end script_context[:specification] = spec end