OpenBEL / bel.rb

Process BEL (Biological Expression Language) with ruby.
Apache License 2.0
8 stars 6 forks source link

Error translating to JSON Evidence format using Oj adapter #93

Closed abargnesi closed 8 years ago

abargnesi commented 8 years ago

Translation to JSON Evidence when using the oj adapter on MRI throws the error:

.../gems/bel-0.4.2/lib/bel/json/adapter/oj.rb:23:in `to_stream': to_stream() expected an IO Object. (ArgumentError)
    from .../gems/bel-0.4.2/lib/bel/json/adapter/oj.rb:23:in `write'
    from .../gems/bel-0.4.2/lib/bel/json.rb:30:in `write'
    from .../gems/bel-0.4.2/lib/bel/translator/plugins/json_evidence/translator.rb:28:in `block in write'
    from .../gems/bel-0.4.2/lib/bel/translator/plugins/json_evidence/translator.rb:48:in `each'
    from .../gems/bel-0.4.2/lib/bel/translator/plugins/json_evidence/translator.rb:48:in `each'
    from .../gems/bel-0.4.2/lib/bel/translator/plugins/json_evidence/translator.rb:48:in `write'
    from .../gems/bel-0.4.2/lib/bel/translate.rb:53:in `translate'
    from .../gems/bel-0.4.2/bin/bel:286:in `run'
    from .../gems/bel-0.4.2/bin/bel:411:in `<top (required)>'
    from .../bin/bel:23:in `load'
    from .../bin/bel:23:in `<main>'

The method Oj.to_stream() expects to write to an IO object, but in this case for the JSON Evidence translator it is nil. A nil IO would indicate to return the encoded JSON string.