Skip to content

jonathanhefner/mini_sanity

Repository files navigation

mini_sanity

In-line sanity checks, written as extensions to core Ruby objects. See API listing below, or browse the full documentation.

Example

require "json"
require "pathname"

path = Pathname.new("hosted_files.json").assert!(&:exist?)

hosted_files = JSON.parse(path.read).assert!(Array)

urls = hosted_files.flat_map do |file_info|
  file_info.fetch("mirror_urls").refute!(&:empty?)
end

domains = urls.map do |url|
  url.assert!(%r"^https?://").split("/")[2]
end.uniq

API

Installation

Install the mini_sanity gem.

Contributing

Run rake test to run the tests.

License

MIT License