• Stars
    star
    2,386
  • Rank 18,494 (Top 0.4 %)
  • Language
    Ruby
  • Created over 8 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ruby Tricks, Idiomatic Ruby, Refactoring and Best Practices

Ruby Tricks, Idiomatic Ruby, Refactorings and Best Practices

Do you know why experienced Ruby programmers tend to reach for basic collections and hashes while programmers from other languages go for more specialized classes? Do you know the difference between strip, chop, and chomp; and why there are three such similar methods when apparently one might suffice (Not to mention lstrip and rstrip!)? Do you know the downsides of dynamic typing? Do you know why the differences between strings and symbols get so blurry, even to experienced Ruby developers? How about metaprogramming? What the heck is an eigenclass? How about protected methods? Do you know what they’re really about? Really? Are you sure? Eloquent Ruby

Absolutely the best way to learn to write idiomatic Ruby code is to read idiomatic Ruby code. Eloquent Ruby

This repository aims to help everyone write more idiomatic, clean, and tricky ruby code and also document good refactoring techniques. You can add your own technique or paste it from some website. Do not forget the source, of course. All the tricks are in the /tricks folder.

For the sake of clarity, you should paste in the markdown format. At the end, if the code is not your own, paste a reference to the author and source of the technique.

In this part we can review some obscure or awesome features from the and the standard ruby library which we normally forget.

You can write Ruby code, but it can sometimes look like Java code. Here you can find some tips to write more naturally and take advantage of idiomatic Ruby.

Small (and big) improvements you can apply to your code and improve it's readability and maintenance. Change the internal structure of the code without changing it's behaviour.

If you keep your house cleaned constantly you'll never need to waste a weekend cleaning it. The same applies to your code. Be disciplined and keep your code looking good with those tips.

Contributors

A big thanks to the following people

Contributing

  1. Fork it
  2. Create a branch with your idea: git checkout -b my-idea
  3. Check in which category it should be: best practice, idiomatic ruby, refactoring or trick. If you don't know, please open an issue and ask.
  4. Add your idea to the collection of .md files in the correct folder (tricks, refactorings, idiomatic_ruby or best_practices) folder
  5. Commit your changes: git commit -am 'Add my idea'
  6. Push to the branch: git push origin my-idea
  7. Create a new Pull Request and explain your technique in the markdown file

More Repositories

1

redux-in-portuguese

Official Redux Documentation translated to portuguese
95
star
2

Dijkstra-Algorithm-Java-GUI

Graph Algorithms built in Java. Using some GUI to show the Graph.
Java
36
star
3

olar

OLAR
Ruby
7
star
4

Power-Iteration-Methods

Power iteration is an eigenvalue algorithm.
Java
6
star
5

Numerical-Integration-Gauss-Quadratures

Gauss Hermite, Laguerre and Chebyshev quadratures implementation
Python
4
star
6

RUdaUFC

Bot in Python to use at @rudaufc twitter.
Python
3
star
7

SPOJ

Problemas feitos do site http://br.spoj.pl/
C
3
star
8

rails4patterns-codeschool

3
star
9

railsapis-codeschool

3
star
10

Computer-Networks

UDP Ping, Mail Client, Web Server and Proxy
Java
3
star
11

rubyfundamental

Ruby Fundamental
Ruby
3
star
12

android-boilerplate

Start your project with this Sample Application and ensure you're following the MVC pattern.
Java
3
star
13

EstruturasDeDados

Data Structures implemented with C during the Programming discipline at UFC, 2010.2
C
3
star
14

Machine-Learning-Algorithms

Machine Learning Algorithms
PHP
2
star
15

android-general-recyclerview

This project shows how to create a simple RecyclerViewAdapter preventing boilerplate code.
Java
2
star
16

LESolver

Methods to solve Linear Equations. Using QT.
2
star
17

Jacobi-HouseHolder-QR

Jacobi algorithm, QR transformation and Householder transformation
Java
2
star
18

refreshable_model_message_bus

Websocket using MessageBus
Ruby
2
star
19

PyboysWebsite

The pyboys website, we're using web2py
Python
2
star
20

PostponedChanges-dbms

Implementation from a recovery algorithm. Postponed Recovery from a Database Management System.
Java
2
star
21

rails_for_zombies

Challenges and Application from railsforzombies.com
Ruby
2
star
22

railsfundamental

RailsFundamental
JavaScript
2
star
23

E-Le-rning

E-Le@rning System built in Python using web2py. This Project was made during the Programming Techniques 1 at UFC, 2011.1.
Python
2
star
24

micro-activerecord

A minimalist Active Record
Ruby
1
star
25

GetJSONWerbservice

Getting JSON Webservice in Android
Java
1
star
26

try-go

Notes about my studies in Go
1
star
27

web2py-repository

System to manage simple files using the web2py features like smartgrid and many to many relantionships.
Python
1
star
28

javadoc-to-rdf

MIT RDFizer Javadoc to RDF using Spring Framework
Java
1
star
29

RadioPlayer

RadioPlayer for android
Java
1
star
30

rails4-release-notes

1
star
31

apostila-metodos-2

Apostila de Métodos Numéricos 2, Universidade Federal do Ceará
1
star
32

simple_file_manager

Simple File Manager for the Discipline (Web Development Applications)
PHP
1
star
33

try-elm

Building Reactive Web Apps with Elm
Elm
1
star
34

Numerical-Integration-NewtonCotes-Legendre

Newton-Cotes rules and Gauss-Legendre quadrature implementation
Python
1
star
35

APKLoader

Load an APK file and use reflection to execute a method
Java
1
star
36

Sistema-Eletr-nica-JavaWeb

System to a Electronic Business, built in Java Web - without Frameworks.
Java
1
star
37

Finite-Difference

Implementation for a simple mask.
Java
1
star
38

notes-for-redux

Notes for Redux
1
star
39

Double-Integral

Double Integral using Newton-Cotes and Gauss-Legendre Integration methods
Python
1
star
40

AndroidSimpleNotes

Simple Notes for your Android Application
Java
1
star
41

elm-simple-linear-algebra

Simple Linear Algebra for Elm
Elm
1
star
42

ruby-bits2

1
star
43

extJS4-fundamental

Examples using ExtJS4
JavaScript
1
star
44

highchartCSV

Plotting from a CSV File using Highcharts
JavaScript
1
star
45

better-tests-in-elixir

Interesting links and comments from the community about how to do better tests in Elixir
1
star
46

GerenciamentoLEC

Final Work to Fundamentals of Database. Application using postgreSQL. Web2py application.
Python
1
star
47

InitialValueProblems

An initial value problem is an ordinary differential equation together with a specified value, called the initial condition, of the unknown function at a given point in the domain of the solution. Runge Kutta 4th order, Backward Euler, ForwardEuler, Euler Modified
Java
1
star
48

war-probabilities

A program which calculates some probabilities of battles in the boardgame War
Java
1
star
49

blog-social

Blog social in Ruby using some gems
Ruby
1
star
50

Numerical-Integration-Double-Exponential

Double and Simple Exponential Numerical Integration
Python
1
star
51

MetodoDeCramer-3x3

Linear System Solver using Cramer Methods to 3x3 Matrices. Using QT.
C++
1
star
52

wiki-comp-mobile

Sistema de Wiki para Android do Curso de Computação da UFC.
Java
1
star
53

InitialValueProblems_Example

This a Example by transforming an explicit method in a implicit method to solve a EDO with Runge Kutta, Eulers and Predictor-Corrector methods.
Java
1
star
54

ProblemasConstrucaoAnaliseAlgoritmos

Problems solved during the Construction and Analysis of Algorithms discipline, at UFC 2011.2. Subjects: Dynamic Programming ,Sorting Algorithms, Algorithms Complexity.
1
star