Exports
Tiny utility for exporting functions in a javascript-like manner.
Example
formula.rb
require 'exports'
Formula = Exports.new
pi = 3.14
Formula.circumference = ->(r) do
2 * pi * r
end
Formula.area = ->(r) do
pi * r ** 2
end
other_file.rb
require 'formula'
fn1, fn2 = Formula.import(:circumference, :area)
puts fn1.(1.5) # 9.42
puts fn2.(1.5) # 7.065
Installation
Add your Gemfile:
gem 'exports'
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request