This is beautiful madness || Rulie

Charlie grabbed his keys and left the house after trying Sophie’s phone for about the ten millionth time. She’d probably made it to the party and was too busy having a good time to actually be bothered to check in with him but all the same… parties at an old farmhouse in the middle of a dark field didn’t fill him with confidence. He’d been iffy on letting her go in the first place. Though maybe Gregory Sharpe had paid a visit considering it was his daughters party… that thought should put him at ease but the thought of Gregory in general still had him a little on edge considering. Anyway, apparently Sophie was staying at a friend’s house, and apparently it had nothing to do with him but she just needed some ‘space.’ As if she hadn’t had enough of that. Charlie hoped that ‘friend’ wasn’t code for ‘Liam’ or he’d probably have a fit when he found out. He checked his phone as he jumped in and then drove out towards the hill. He was still a little freaked out by the text -A had sent him earlier but he was that way every time he got a message from them no matter what the content. He just hated the things they said, the things they could make everybody else believed. Still, at least Ruby would never believe it. He was fairly sure of that. Even if she did doubt him for some reason, he hoped she would ask him before distancing herself or getting defensive… he hated the way they usually did things like that. It made it hurt more. He hadn’t been lying when he said he missed her though.. It had only been, what, a week since she’d stayed over and they’d said they would try. Charlie wouldn’t deny he’d felt lighter since then, happier maybe if that was possible, just knowing that she actually wanted to despite everything. They shouldn’t work but they did and he realised he loved that. It had been hard to find time to see her properly after that night. He’d had to call his estate agent and tell them he’d changed his mind and wouldn’t be moving after all. He’d had to call the headmaster of the school and ask if the offer of his job back after summer was still on the table… not that working opposite Tim Lewis, if he was staying on, appealed to him and he wasn’t sure he’d be able to control himself. He’d had to try and sort things with Sophie, who he was actually really worried about.

So it was a bit of a good thing that she hadn’t seemed to have made plans with anyone to give her a lift home… he really did want to see her. He felt like he was getting better, like he could maybe be this person and… be okay with it. She seemed to like him, seemed to understand him more than perhaps anybody else… and he liked that. He really liked it. Charlie pulled up beside the wall, the gate he’d planned to meet Ruby by in clear view, and waited for her with the engine still running. He felt a little bad suddenly that he’d said he’d meet her here because he realised it was a further walk than he’d thought it was and… would she be okay walking on her own? Maybe she’d ask someone to walk with her… though that would risk them seeing him pick her up but he’d rather that than her walking aloneand being scared. The dark could play tricks on people. Though there hadn’t really been many other places to meet her without a bunch of people spotting him and he could cover and say he was collecting Sophie… but that would ruin his plan of spending time with Ruby. He hoped she’d ended up having a good time. She’d said she hadn’t hated it so that was promising… A police car whizzed past him and he frowned, turning in his seat to watch it drive off down the dark lane but it was probably going somewhere else. He looked down and fiddled with his phone while he waited, deleting some messages and whatever just to keep himself occupied.

Ruby 2.0 - O que há de novo?

Opa pessoal, tudo bom?

A algumas semanas, o Ruby 2.0 foi lançado oficialmente. Depois de ter baixado no meu mac e dado uma lida no release notes e em alguns blogs, resolvi fazer um post com as features novas que eu achei mais legais.

Lista de símbolos

No Ruby 1.9, para se criar um array de símbolos, você precisava instanciar o array e colocar os símbolos que te interessavam nele. Agora, através da notação %i (%i é uma abreviação para “intern”).Abaixo você tem um exemplo de como ele funciona:

UTF-8 como default encoding

\o/ essa é uma das boas. Lembra quando você colocava caracteres especiais no seu .rb e não sabia por que o script não funcionava? Era devido o charset aceito. Por padrão, o Ruby 1.9.x tinha encoding US-ASCII. Então você era obrigado a definir o encoding através do magic comment. Agora, no ruby 2.0, o padrão é o UTF-8, facilitando a nossa vida.

Método protocolo to_h

Antigamente, precisávamos criar nossa própria implementação para transformar um objeto em um hash. No ruby 2.0 isso não será mais necessário através do método to_h


Todos sabem que, em ruby, todas as classes são abertas. Você pode simplesmente, modificar um método que já existe e criar sua própria implementação. Um exemplo disse são os métodos secods, minutes, hours entre outros que você possui no ActiveSupport do Rails. Porém, no ruby 2.0 é apresentado o conceito de refinements e using, para que você possa encapsular esse novo comportamento e usa-lo apenas quando você, explicitamente, o inclui em sua classe. Segue um exemplo abaixo:

De tudo que eu ví, foram as mais bacanas, mas existem outras. Vou listar abaixo alguns posts de blogs que contém outras features.

É isso ai pessoal!