Roman V. Babenko

gem install rails_best_practices && rails_best_practices --without-color | grep "^\./" | wc -l ~> 0

Continuous Integration With Ruby

Prologue

Introduction

I’ve been working on four different projects during last year and so i have a very fresh expirience of entering into existing process of development as new member of team. Problems appeared from the very beginning when i have just started building each project, configuring and first attempts of running.

But after i finally succeeded with all that staff i had a strong wish to prevent such situation in future, which in fact looks like cartoon with famous song The Cat came back, where main hero, trying to get rid from naughty cat, saw his cat again next morning by the door.

Vim. Automatically Removing All Trailing Whitespace

One way to make sure to remove all training whitespace in a file is to set an autocmd in your .vimrc file.

Everytime the user issue a :w command, Vim will automatically remove all trailing whitespace before saving.

~/.vimrc

1
autocmd BufWritePre * :%s/\s\+$//e

Delegation in Ruby

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require "forwardable"
class Profile
attr_accessor :last_name, :first_name
def initialize
@last_name, @first_name = 'Doe', 'John'
end
def full_name
"#{self.first_name} #{self.last_name}"
end
end
class Person
extend Forwardable
def initialize
@profile = Profile.new
end
def_delegator :@profile, :full_name, :fn
end
1
2
$ puts Person.new.fn
=> John Doe