Skip to content
This repository was archived by the owner on Jun 4, 2026. It is now read-only.
packrat386Public archive

About

A gem to do something exactly once

Resources

Code of conduct

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Isochron

A gem to do something exactly once. Inspired by Go's sync.Once.

Installation

Add this line to your application's Gemfile:

gem 'isochron'

And then execute:

$ bundle

Or install it yourself as:

$ gem install isochron

Usage

mylist = ['a', 'b', 'c']

# returns a capture object holding the passed block
cap = Isochron.capture do
  mylist.pop
end

# the first call executes the block, subsequent calls return the stored value
pp cap.call
pp cap.call
pp mylist

=begin
 [fg-386] isochron > ruby example.rb
"c"
"c"
["a", "b"]
=end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/packrat386/isochron. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

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

Code of Conduct

Everyone interacting in the Isochron project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

A gem to do something exactly once

Resources

Code of conduct

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages