Frontendrails logo Front End Rails

The Story of Four Weathers, or You Don't Need an API Wrapper

The Story of Four Weathers, or You Don't Need an API Wrapper

zverok with ruby zverok with ruby 23 February 2017

Once Rubyist see a new useful HTTP API, her/his first thought would be “does it have a Ruby wrapper?”, and if not, the next would be “once, I should do a Ruby wrapper for this!”

Small steps to DRYer RSpec

Small steps to DRYer RSpec

zverok with ruby zverok with ruby 22 January 2017

RSpec API is constantly evolving towards as DRY and readable DSL as possible. Though, there are several things (tricks and additional methods) that could make your specs even DRYer.

MiniTest is not "Just Ruby", it is "Just Rails"

MiniTest is not "Just Ruby", it is "Just Rails"

zverok with ruby zverok with ruby 09 October 2016

MiniTest recently have gained a lot of love and respect from Ruby community, as a “less magical” alternative to RSpec (which is, apparently, “too complicated” for nowadays rubyists). The one quote proudly cited on each MiniTest release email, and in its README, is

Notes On Sane Monkey-patching

Notes On Sane Monkey-patching

zverok with ruby zverok with ruby 28 September 2016

Here are (semi)random notes, trying to outline a system of views on controversional “monkey-patching” topic—the views I myself consider sane and reasonable. It may seem other way for you, but it could be a start for rational discussion.

Tricks with RSpec components outside RSpec

Tricks with RSpec components outside RSpec

zverok with ruby zverok with ruby 02 September 2016

In this short post I’d like to show how some of RSpec components (matchers and expectations) can be used for a greater good outside your tests. Like in your normal everyday scripts.

TimeMath: ActiveSupport envy vs good selection of atomic concepts

TimeMath: ActiveSupport envy vs good selection of atomic concepts

zverok with ruby zverok with ruby 27 June 2016

When I’ve started to design time_math2 gem, I’ve already had a strong set of opinions in my head, of why and how it should be done. Like: * concise set of well-defined operators for math arithmetics, easy to comprehend and remember; * no invasion into Ruby core classes; * code using TimeMath should be readable, unambiguous and short.

New Reality release: comprehensive docs and other cool things

New Reality release: comprehensive docs and other cool things

zverok with ruby zverok with ruby 18 April 2016

Remember the Reality library? That thing which wants to make the entire world inspectable and computable through Ruby, Wikipedia, Wikidata and other data sources? Like this:

Good Ruby Idiom: and/or operators

Good Ruby Idiom: and/or operators

zverok with ruby zverok with ruby 23 February 2016

Any tutorial and book will teach you there are two sets of similar operators in Ruby: &&/|| vs and/or (and also &/| for bit operations, but that’s not the case today). But typical tutorial will not provide further explanation why we need both of those pairs.

Implicit vs explicit type conversions in Ruby (to_h/to_hash and others)

Implicit vs explicit type conversions in Ruby (to_h/to_hash and others)

zverok with ruby zverok with ruby 18 January 2016

I should repeat: never implement implicit conversion methods unless you sure know what you are doing! It is widely seen, for example, the #to_hash method being implemented (maybe because of “prettier name” than #to_h?) and causing strangest effects.