ruby-to-crystal-shim

crystal-ruby-shim

Crystal is a great language that has many syntactic and semantic similarities to Ruby despite the fact that it is a statically compiled language and Ruby is dynamic. Crystal also has some fundamental differences in design and philosophy that mean that it will never be just "compiled Ruby".

  • This is a good thing!
  • Crystal and Ruby can co-exist and do their own things!
  • You probably don't need this library!

This shim monkeypatches (with all the negative connotation that carries) various Crystal interfaces so that they will be compatible with Ruby. In many cases this is as simple as adding method aliases. The Crystal project avoids using aliases and has chosen different names for many standard library methods that otherwise have the same interface and functionality as the corresponding Ruby methods.

Installation

Add this to your application's shard.yml:

dependencies:
  crystal-ruby-shim:
    github: tristil/crystal-ruby-shim

Usage

require "ruby-to-crystal-shim/time/strftime" # add "strftime" alias to Time
require "ruby-to-crystal-shim/object/attr_methods" # add "attr_" alias to Time

Requiring "crystal-ruby-shim" will pull in all the monkeypatches. If you only want a subset of the changes you should require files individually. For example:

require "crystal-ruby-shim"

Contributing

  1. Fork it ( https://github.com/[your-github-name]/crystal-ruby-shim/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

ruby-to-crystal-shim

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 0
  • over 9 years ago
  • September 23, 2015
License

MIT License

Links
Synced at

Sun, 22 Dec 2024 17:52:05 GMT

Languages