Class: Bioinform::YAMLParser

Inherits:
Parser show all
Defined in:
lib/bioinform/parsers/yaml_parser.rb

Overview

YAMLParser can be used to parse hashes returned by #parse method of other parsers: yaml_dump_of_pm = PM.new(…).to_yaml PM.new(yaml_dump_of_pm, YAMLParser)

Instance Attribute Summary

Attributes inherited from Parser

#input

Instance Method Summary collapse

Methods inherited from Parser

array_from_acgt_hash, choose, need_tranpose?, normalize_hash_keys, parse, #parse, parse!, transform_input, try_convert_to_array, valid_matrix?

Methods included from Parser::SingleMotifParser

#each, included

Constructor Details

#initialize(input) ⇒ YAMLParser

Returns a new instance of YAMLParser.



11
12
13
# File 'lib/bioinform/parsers/yaml_parser.rb', line 11

def initialize(input)
  @input = input
end

Instance Method Details

#parse!Object



14
15
16
17
18
# File 'lib/bioinform/parsers/yaml_parser.rb', line 14

def parse!
  YAML.load(input)
rescue Psych::SyntaxError
  raise 'parsing error'
end