Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ijackua/ruby-di-playground

Try different approaches for Dependency Injection in Ruby code
https://github.com/ijackua/ruby-di-playground

dependency-injection ruby

Last synced: 17 days ago
JSON representation

Try different approaches for Dependency Injection in Ruby code

Awesome Lists containing this project

README

        

## Ruby dependency injection experiments

Each sub-folder contains own implementation of the similar synthetic functionality

### How to run?

* `ruby ./hardcode/server.rb` - start a fake web app
* open `http://localhost:8080/` to run our action

### Expectations

Initial behavior

```
» ruby ./server.rb 130 ↵
...
Start App action
LogStorage::call |> Save to File. Msg: get_by_id via 'jdbc:postgresql://localhost:1234/users'
App |> User: Ievgen
Finish App action
```

Behavior after classes monkey-patching

```
» ruby ./server.rb 130 ↵
...
Start App action
LogStorage::call |> Send to Elastic. Msg: get_by_id via 'jdbc:sqlite://skynet:1234/humanoids'
App |> User: Ievgen
Finish App action
```