Sha256: 79e458460039455ebad8e556be1b280aeb076f5c9c935b38a51b5abec2d19927

Contents?: true

Size: 228 Bytes

Versions: 21

Compression:

Stored size: 228 Bytes

Contents

# frozen_string_literal: true

# Monkey patching the Ruby Core class String
class String
  # ...
  def valid_json?
    JSON.parse(self)
    true
  rescue JSON::ParserError
    false
  end

  alias is_valid_json? valid_json?
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
cotcube-helpers-0.1.4 lib/cotcube-helpers/string_ext.rb