Project

kaicho

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

Development

~> 2.0
~> 0.8, >= 0.8.22
~> 12.3, >= 12.3.1
>= 3.8.0, ~> 3.8
 Project Readme

Kaicho

Build Status Coverage Status Inline docs Gem Version

Kaicho is the boss for your resources. It handles keeping everything up to date.

class Fruits
  include Kaicho

  def intialize
    def_resource :apples, accessor: :both { @apples || 0 }
    def_resource :oranges, accessor: :both { @oranges || 0 }
    def_resource :total, depend: { apples: :fail, oranges: :fail } do
      puts "computing total"
      @apples + @oranges
    end
  end
end

f = Fruits.new
f.apples         #=> 0
f.apples += 1    #=> 1
computing total
f.oranges = 10   #=> 10
computing total
f.total          #=> 11
f.oranges = 2
computing total
f.total          #=> 13
f.total          #=> 13