RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Submit a post

You can use basic HTML markup (e.g. <a>) or Markdown.
Note that your post may be edited to suit the format of the site.

As you are not logged in, you will be
directed via GitHub to signup or sign in

Post Preview

Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.

RSpec Mocks and Stubs in Plain English

One of the most common questions I see from beginners to Rails testing is what mocks and stubs are and when to use them. https://www.codewithjason.com/rspec-mocks-stubs-plain-english/ If you’re confused about mocks and stubs, you’re not alone. In my experience very few people understand them. In this post I’ll attempt to help clarify the matter, particularly in the context of Rails/RSpec. [more inside]

ValueSemantics—A Gem for Making Value Classes

ValueSemantics is a gem for making value classes, with attribute defaults, validation, and coercion. This article also covers some of its design considerations, such as using exceptions to catch developer mistakes, extensibility, being unobtrusive, integration continuity, stability, thin DSLs, and “no setters” immutability.

How to Tell the Difference Between a Default and a Provided Value for Optional Argume

It is sometimes required for the methods with optional arguments to be able to differentiate between its default value and the value passed from the caller. Passing nil might initially sound like a good idea since it represents “nothingness”. However, it might turn out that nil is a legit value and there might be cases where it is desirable for the caller to pass nil. In such a case, we cannot use it as a default value if we want to implement a special logic for the case of not providing that value. [more inside]

Programming Crypto Blockchain Contracts (in Ruby) Step-by-Step Guide / Book

Hello, I’ve started a new (free online) step-by-step guide / booklet titled “Programming Crypto Blockchain Contracts (with Ruby) Step-by-Step Book / Guide Let’s Start with P@nzi & Pyr@mid Schemes. Run Your Own Lotteries, G@mbling C@sinos and more on the Blockchain World Computer…”. The first chapter is online with ready-to-run contract scripts in ruby. Don’t Miss the Investment of a Lifetime! May the Brave be Rewared with Riches! Cheers. Prost.

Ruby's p vs puts Method

The puts method in ruby is very popular all over the internet it’s generally used by ruby programmers for debugging purposes and to output the value of certain variables so we can see what’s goin on in our system. However puts can sometimes lead you astray because of how it converts everything into a string. See how p is different from puts

Loading older posts