Socket
Book a DemoInstallSign in
Socket

depression

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

depression

0.1.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Easy Resolution of Before/After Relations For Ruby

Depression resolves before/after relations by forming a graph of them and flattening it. It supports simple before/after as well as "greedy" relations.

Getting Started

$ gem install depression

After installation the first steps are really easy. You simply need a bunch of objects that respond to #name as well as #relations and return something more or less unique and a hash, resp.

require "depression"

Item = Struct.new(:name, :relations)
items = [
  Item.new(:foo, {}),
  Item.new(:bar, :before => [:foo]),
  Item.new(:baz, :after => [:foo])
]

sorted = Depression.process(items)
puts sorted.map {|i| i.name }.join(",")
# bar,foo,baz

Greedy Relations

TODO

Resolving Conflicts

TODO

Resolving Circular Relations

TODO

Dependencies

  • mocha and test-unit for development

Runs fine on Ruby 1.9.2 and JRuby 1.5.6.

To do & Ideas

  • Gracefully drop greedy relations if they conflict with normal relations
  • Implement a "friendly" mode that simply drops "older" relations until a circular relation is resolved
  • Visualize various stages of relation resolution (probably via GraphViz)
  • Maybe switch to TSort

Contributing

You can also open an issue for discussion first, if you want.

License

Depression is subject to an MIT-style license that can be found in the LICENSE file.

FAQs

Package last updated on 13 Jan 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.