A plugin for Roda which turns your application into a (IoC) container
gem 'roda-container'
class MyApplication < Roda
plugin :container
end
class UserRepository
def self.first
{ name: 'Jack' }
end
end
MyApplication.register(:user_repository, UserRepository)
MyApplication.resolve(:user_repository).first
# => {:name=>"Jack"}
class PersonRepository
def first
{ name: 'Jill' }
end
end
MyApplication.register(:person_repository, -> { PersonRepository.new })
MyApplication.resolve(:person_repository).first
# => {:name=>"Jill"}
- Fork it ( https://github.com/AMHOL/roda-container )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request