Giter VIP home page Giter VIP logo

airac's Introduction

Version Tests Code Climate GitHub Sponsors

AIRAC

AIRAC (Aeronautical Information Regulation And Control) cycle calculations for Ruby.

Thank you for supporting free and open-source software by sponsoring on GitHub or on Donorbox. Any gesture is appreciated, from a single Euro for a โ˜•๏ธ cup of coffee to ๐Ÿน early retirement.

Install

Security

This gem is cryptographically signed in order to assure it hasn't been tampered with. Unless already done, please add the author's public key as a trusted certificate now:

gem cert --add <(curl -Ls https://raw.github.com/svoop/airac/main/certs/svoop.pem)

Bundler

Add the following to the Gemfile or gems.rb of your Bundler powered Ruby project:

gem 'airac'

And then install the bundle:

bundle install --trust-policy MediumSecurity

Usage

You can use this gem in your Ruby project:

cycle = AIRAC::Cycle.new('2018-01-01')
cycle.date         # => #<Date: 2017-12-07>
cycle.effective    # => 2017-12-07 00:00:00 UTC..2018-01-03 23:59:59 UTC
cycle.id           # => 1713
(cycle + 5).id     # => 1804
(cycle - 5).id     # => 1708

The cycle can be formatted similar to Date#strftime, however, the placeholder %i represents the AIRAC cycle ID:

cycle = AIRAC::Cycle.new('2018-01-01')
cycle.to_s                            # "1713 2017-12-07"
cycle.to_s("@%i as per %b %-d, %Y")   # => "@1713 as per Dec 7, 2017"

The current AIRAC cycle scheme started on 2015-06-25, therefore any calculation which leads to dates prior to inception will cause an error:

(cycle - 100).id   # => ArgumentError

The AIRAC::Cycle class implements Comparable and its instances can safely be used s Hash keys.

If you prefer to do the math on the shell, the airac executable is your friend:

airac --help

Development

To install the development dependencies and then run the test suite:

bundle install
bundle exec rake    # run tests once
bundle exec guard   # run tests whenever files are modified

You're welcome to submit issues and contribute code by forking the project and submitting pull requests.

License

The gem is available as open source under the terms of the MIT License.

airac's People

Contributors

svoop avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.