Sha256: 7eb5fe1836deb8e5fefb1e9386c5ad662dc33aebd8c3ff8fa56c688ceb0faaa3

Contents?: true

Size: 876 Bytes

Versions: 1

Compression:

Stored size: 876 Bytes

Contents

require 'bel_parser'
require 'bel_parser/resource/resource_url_reader'
require 'bel/evidence_model'

module BEL::Translator::Plugins
  module BelScript
    class Reader
      include ::BELParser::Script

      def initialize(io)
        @io    = io
        @state = {
          resource_reader: BELParser::Resource::ResourceURLReader.new(true),
          specification: BELParser::Language.specification('2.0'),
          namespace_definitions: {}
        }
      end

      def each
        if block_given?
          NanopubMapper.new(
            Validator.new(
              StateAggregator.new(
                FirstNode.new(Filter.new(BELParser::ASTGenerator.new(@io))),
                @state))).each do |hash|
                  yield ::BEL::Model::Evidence.create(hash)
                end
        else
          enum_for(:each)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bel_parser-1.0.0.alpha.21 lib/bel/translator/plugins/bel_script/reader.rb