Class: BELRDF::Translator
- Inherits:
-
Object
- Object
- BELRDF::Translator
- Includes:
- BEL::Translator
- Defined in:
- lib/bel/translator/plugins/rdf/translator.rb
Instance Method Summary collapse
-
#initialize(format, write_schema = true) ⇒ Translator
constructor
A new instance of Translator.
- #read(data, options = {}) ⇒ Object
- #write(objects, io = StringIO.new, options = {}) ⇒ Object
Constructor Details
#initialize(format, write_schema = true) ⇒ Translator
Returns a new instance of Translator.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/bel/translator/plugins/rdf/translator.rb', line 16 def initialize(format, write_schema = true) @format = format write_schema = true if write_schema.nil? @rdf_schema = if write_schema BELRDF::RDFS_SCHEMA else [] end end |
Instance Method Details
#read(data, options = {}) ⇒ Object
28 29 30 |
# File 'lib/bel/translator/plugins/rdf/translator.rb', line 28 def read(data, = {}) Reader::UnbufferedNanopubYielder.new(data, @format) end |
#write(objects, io = StringIO.new, options = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bel/translator/plugins/rdf/translator.rb', line 32 def write(objects, io = StringIO.new, = {}) write_rdf_to_io(@format, objects, io, ) case io when StringIO io.string else io end end |