class Bump::CLI::Resource

Public Class Methods

parse(content) click to toggle source
# File lib/bump/cli/resource.rb, line 16
def self.parse(content)
  ::JSON.parse(content)
rescue ::JSON::ParserError
  begin
    ::YAML.safe_load(content, [Date, Time])
  rescue ::Psych::SyntaxError
    content
  end
end
read(location) click to toggle source
# File lib/bump/cli/resource.rb, line 7
def self.read(location)
  if location.start_with?("http")
    ::HTTP.follow(max_hops: 50)
      .get(location).to_s
  else
    ::File.read(location).force_encoding(Encoding::UTF_8)
  end
end