Class: ActiveFacts::Input::CQL
- Inherits:
-
Object
- Object
- ActiveFacts::Input::CQL
- Defined in:
- lib/activefacts/input/cql.rb
Overview
Compile CQL to an ActiveFacts vocabulary. Invoke as
afgen --<generator> <file>.cql
Class Method Summary collapse
-
.read(file, filename = "stdin") ⇒ Object
Read the specified input stream.
-
.readfile(filename) ⇒ Object
Read the specified file.
-
.readstring(str, filename = "string") ⇒ Object
Read the specified input string.
Class Method Details
.read(file, filename = "stdin") ⇒ Object
Read the specified input stream
28 29 30 |
# File 'lib/activefacts/input/cql.rb', line 28 def self.read(file, filename = "stdin") readstring(file.read, filename) end |
.readfile(filename) ⇒ Object
Read the specified file
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/activefacts/input/cql.rb', line 16 def self.readfile(filename) File.open(filename) {|file| read(file, filename) } rescue => e # Augment the exception message, but preserve the backtrace ne = StandardError.new("In #{filename} #{e..strip}") ne.set_backtrace(e.backtrace) raise ne end |
.readstring(str, filename = "string") ⇒ Object
Read the specified input string
33 34 35 36 |
# File 'lib/activefacts/input/cql.rb', line 33 def self.readstring(str, filename = "string") compiler = ActiveFacts::CQL::Compiler.new(filename) compiler.compile(str) end |