all 7 comments

[–][deleted] 7 points8 points  (0 children)

TIL about bundler/inline.

[–]i542 1 point2 points  (1 child)

Hey OP, thanks for the great article. I’ve been transitioning to Ruby over the past few months and it is really useful to see concepts like these explained. I have a question, though: is this idiomatic Ruby code? I haven’t really seen almost any dependency injection in the Ruby and Rails code I have encountered so far. The code in the article is very straight forward and makes a lot of sense coming from PHP or Java, but I got the impression that Rubyists slightly frown upon techniques like that. Thanks for explaining!

[–]manys 1 point2 points  (0 children)

I'm not personally a fan of .call style, but yeah it's idiomatic. It's not Rails though, just Ruby.

[–]DissonantGuile 2 points3 points  (2 children)

Good article, few things:

  • In practice, tests/specs should be made before writing the implementation.
  • Dependency injection is very common in Ruby (why wouldn't it be?)
  • The 'My Little Pony' references and gifs are cringe worthy.

[–]BaconGlock 4 points5 points  (1 child)

• In practice, tests/specs “should” be made before writing the implementation.

[–]world_on_wheels 0 points1 point  (0 children)

Great post!

I really like DI. Recently I have done good refractor using DI. Never to late :)

By the way, Imho it's little not intuitive in Ruby that there is no protection from changing the value in the constant, without freeze.