Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Polishing Ruby - RubyConf 2014

Olivier Lacan
November 18, 2014

Polishing Ruby - RubyConf 2014

There are gems out there solving very common problems that could easily be contributed back to Ruby itself. Suggesting a new Ruby feature isn't as daunting as it sounds. As long as you're diligent, you too can push ruby forward.

Olivier Lacan

November 18, 2014
Tweet

More Decks by Olivier Lacan

Other Decks in Technology

Transcript

  1. Improving the world a little for a good reason is

    better than changing it a lot for a bad one.
  2. +1

  3. Given a user,
 When I ask the User API,
 Then

    I should receive data about this user.
  4. user = create(:user, name: “Olivier”) response = get(“/api/users/1.json”) data =

    JSON.parse(response.body) ! expect(data). to include({ name: “Olivier”})
  5. user = create(:user, name: “Olivier”) response = get(“/api/users/1.json”) data =

    JSON.parse(response.body) ! expect(data). to include({ name: “Olivier”})
  6. x = { a: true, b: false } ! y

    = { a: true } ! x.include?(y) => false
  7. “ Principe of least astonishment If a necessary feature has

    a high astonishment factor, it may be necessary to redesign the feature.
  8. x = "abc" => "abc" ! x.include?("a") => true !

    x.include?("d") => false ! x.include?("abc") => true
  9. a = [1,2,3] => [1, 2, 3] ! a.include?(1) =>

    true ! a.include?(4) => false ! a.include?([1,2,3]) => false
  10. x = { a: true, b: false } ! y

    = { a: true } ! x.contain?(y) => true
  11. Lesson #4 ! There are many good humans in the

    community who will help you.
  12. Before Iterate over the hash or use a 
 side-effect

    of another method (hack) to the achieve expected result.
  13. After Ask hash if it contains another hash: it responds

    true or false. It’s an expressive and less surprising interface.