Project

circuits

0.0
No commit activity in last 3 years
No release in over 3 years
Express logical circuits in code
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 0.8
~> 10.0
~> 3.6
~> 3.3
~> 0.34
~> 0.8.7
 Project Readme

Build Status Gem Version Coverage Status Code Climate Dependency Status docs

Circuits

Express logical circuits in code!

How it works

You define components in terms of other component's inputs and outputs. Every "tick" the components compute their next outputs. In between each "tick" the "tock" will update the outputs before the next tick

Installation

Add this line to your application's Gemfile:

gem 'circuits'

And then execute:

$ bundle

Or install it yourself as:

$ gem install circuits

Usage

Using a component

and_gate = Circuits::Component::And.new
# Set the inputs
and_gate.a.set true
and_gate.b.set false
# Update the AND gate
and_gate.tick # compute the next output from the inputs
and_gate.tock # apply to the output after all components have "ticked"
# Get the output
and_gate.out.get # false

Linking components

and_gate = Circuits::Component::And.new
not_gate = Circuits::Component::Not.new
not_gate.in.set and_gate.out

Contributing

  1. Fork it ( https://github.com/meringu/circuits/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Make your changes
  4. Run the tests (bundle exec rake)
  5. Bump the version ( http://semver.org/ )
  6. Push to the branch (git push origin my-new-feature)
  7. Create a new Pull Request