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

  1. Fork it
  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