Class: BEL::Extension::Format::FormatBEL

Inherits:
Object
  • Object
show all
Includes:
Formatter
Defined in:
lib/bel/extensions/bel.rb

Constant Summary collapse

ID =
:bel
MEDIA_TYPES =
%i(application/bel)
EXTENSIONS =
%i(bel)

Instance Method Summary collapse

Methods included from Formatter

#evidence_hash

Instance Method Details

#deserialize(data, &block) ⇒ Object



25
26
27
# File 'lib/bel/extensions/bel.rb', line 25

def deserialize(data, &block)
  EvidenceYielder.new(data)
end

#file_extensionsObject



21
22
23
# File 'lib/bel/extensions/bel.rb', line 21

def file_extensions
  EXTENSIONS
end

#idObject



13
14
15
# File 'lib/bel/extensions/bel.rb', line 13

def id
  ID
end

#media_typesObject



17
18
19
# File 'lib/bel/extensions/bel.rb', line 17

def media_types
  MEDIA_TYPES
end

#serialize(objects, writer = StringIO.new, options = {}) ⇒ Object



29
30
31
32
33
34
# File 'lib/bel/extensions/bel.rb', line 29

def serialize(objects, writer = StringIO.new, options = {})
  BELYielder.new(objects).each { |bel_part|
    writer << "#{bel_part}"
    writer.flush
  }
end