Sha256: d7797ad57aa054736c4411c4138d3d654dacf9f3fbaea0e3fb22faab50a49d8a

Contents?: true

Size: 840 Bytes

Versions: 28

Compression:

Stored size: 840 Bytes

Contents

#================================================
# SCBI - dariogf <soporte@scbi.uma.es>
#------------------------------------------------
#
# Version: 0.1 - 04/2009
#
# Usage: require "utils/json_utils"
#
# Fasta utilities
#
# 
#
#================================================

module JsonUtils
  
  require 'json';
  
     
  def to_pretty_json
    return JSON.pretty_generate(self)
  end


  def from_json
       return JSON.parse(self)
  end
  
  # ===========================================
  
  #------------------------------------
  # get json data
  #------------------------------------
  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
  
end


Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
seqtrimnext-2.0.68 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.66 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.62 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.61 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.60 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.59 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.57 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.56 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.55 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.54 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.52 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.51 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.50 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.49 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.48 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.46 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.45 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.42 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.41 lib/seqtrimnext/utils/json_utils.rb
seqtrimnext-2.0.39 lib/seqtrimnext/utils/json_utils.rb