0.0
No commit activity in last 3 years
No release in over 3 years
A very simple acts as graph for your model
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
 Project Readme

acts_as_graph

Build Status

A very simple acts as graph for your model

rubygems.org link: https://rubygems.org/gems/acts_as_graph

How to use

If you have a model like this code below:

class Task

  attr_reader :title
  attr_accessor :depended_tasks

  def initialize title, depended_tasks = []
    @title = title
    @depended_tasks = depended_tasks
  end

end

Then you could use acts_as_graph

class Task

  include ActsAsGraph

  acts_as_graph children: :depended_tasks

  attr_reader :title
  attr_accessor :depended_tasks

  def initialize title, depended_tasks = []
    @title = title
    @depended_tasks = depended_tasks
  end

end

And Then:

task.descendant_depended_tasks    # returns all the descendant

task.has_circular_reference?    # check if descendant has circular reference

Check unit tests for more information