class Ruth::Gemfile::JSON

JSON suppoer for Ruth

Attributes

json[RW]

Public Class Methods

new(json) click to toggle source
# File lib/ruth/json.rb, line 7
def initialize(json)
  @json = json
  @data = parse_json_file
end

Private Instance Methods

parse_json_file() click to toggle source

Private - Read JSON file

Return Hash

# File lib/ruth/json.rb, line 17
def parse_json_file
  if File.exist?(@file)
    JSON.parse(IO.readlines(@file))
  else
    JSON.parse(@file)
  end
end