source: ruby/trunk/adl_parser/lib/shell.rb@ 4

Last change on this file since 4 was 4, checked in by KOBAYASHI, Shinji, 16 years ago

restructuring repository tree

File size: 784 bytes
Line 
1$:.unshift File.join(File.dirname(__FILE__))
2require 'validator.rb'
3require 'stringio'
4
5module OpenEHR
6 module Application
7 class Shell
8 def run
9 raise 'not implemented'
10 end
11 end
12
13 class ADLValidator < Shell
14 def initialize(validator)
15 @validator = validator
16 end
17
18 def run(input, name = nil)
19 input_stream = case input
20 when String
21 StringIO.new(input)
22 when File
23 input
24 when StringIO
25 input
26 else
27 raise
28 end
29 @validator.validate(input_stream.read, name)
30 input_stream.close
31 end
32 end
33 end
34end
35
Note: See TracBrowser for help on using the repository browser.