module JsonUtils

SCBI - dariogf <soporte@scbi.uma.es>

Public Class Methods

get_json_data(file_path) click to toggle source
# File lib/seqtrimnext/utils/json_utils.rb, line 34
def self.get_json_data(file_path)
  file1 = File.open(file_path)
  text = file1.read
  file1.close

  # wipe text
  text=text.grep(/^\s*[^#]/).to_s

  # decode json
  data = JSON.parse(text)

  return data
end

Public Instance Methods

from_json() click to toggle source
# File lib/seqtrimnext/utils/json_utils.rb, line 25
def from_json
     return JSON.parse(self)
end
to_pretty_json() click to toggle source
# File lib/seqtrimnext/utils/json_utils.rb, line 20
def to_pretty_json
  return JSON.pretty_generate(self)
end