jonathanhefner / mini_sanity

In-line sanity checks in Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

In-line sanity checks in Ruby

License:MIT License


Languages

Language:Ruby 100.0%