lib/bel_parser/language.rb in bel_parser-1.0.0.alpha.7 vs lib/bel_parser/language.rb in bel_parser-1.0.0.alpha.8

- old
+ new

@@ -5,27 +5,37 @@ require_relative 'language/signature' require_relative 'language/specification' require_relative 'language/expression_validator' module BELParser + # Language defines the concepts needed to define, represent, and + # validate a BEL specification. This includes: + # + # - {BELParser::Language::Specification BEL specifications} + # - Functions + # - ReturnTypes + # - Signatures + # - Relationships + # - Encodings + # - Syntax validations + # - Semantic validations + # - Generic Syntax validations + # - Generic signature validation module Language - # Mutex to synchronize creation of BEL specifications. LOCK = Mutex.new private_constant :LOCK # Indicates if +version+ is a defined BEL specification. # # @param [#to_s] version the BEL version string (e.g. +"2.0"+) # @return [Boolean] +true+ if +version+ is defined; +false+ if not def self.defines_version?(version) - begin - specification(version) - true - rescue ArgumentError, LoadError - false - end + specification(version) + true + rescue ArgumentError, LoadError + false end # Returns all version strings that are defined and supported by this # project. # @@ -58,10 +68,10 @@ # supported # @see {.defines?} def self.specification(version) version_string = version.to_s unless version_string =~ /^[0-9]+\.[0-9]+/ - raise ArgumentError, "Version format incorrect; expecting MAJOR.MINOR" + raise ArgumentError, 'Version format incorrect; expecting MAJOR.MINOR' end LOCK.synchronize do version_sym = version_string.to_sym @specs ||= {}