Class: BEL::Translator::Plugins::BelScript::Reader
- Inherits:
-
Object
- Object
- BEL::Translator::Plugins::BelScript::Reader
- Includes:
- BELParser::Script
- Defined in:
- lib/bel/translator/plugins/bel_script/reader.rb
Constant Summary collapse
- SyntaxError =
::BELParser::Language::Syntax::SyntaxError
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(io, options = {}) ⇒ Reader
constructor
A new instance of Reader.
Constructor Details
#initialize(io, options = {}) ⇒ Reader
Returns a new instance of Reader.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/bel/translator/plugins/bel_script/reader.rb', line 12 def initialize(io, = {}) @io = io = { :language => '1.0' }.merge() @state = { uri_reader: BELParser::Resource.default_uri_reader, url_reader: BELParser::Resource.default_url_reader, specification: BELParser::Language.specification([:language]), namespace_definitions: {} }.merge() end |
Instance Method Details
#each ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bel/translator/plugins/bel_script/reader.rb', line 27 def each if block_given? NanopubMapper.new( Validator.new( StateAggregator.new( FirstNode.new(Filter.new(BELParser::ASTGenerator.new(@io))), @state)) ).each do |(num, line, ast_node, nanopub_hash)| yield ::BEL::Nanopub::Nanopub.create(nanopub_hash) end else enum_for(:each) end end |