Новый синтаксис хешей в Руби

Метки: руби

Новий синтаксис хешів в Рубі Новий синтаксис хешів в Рубі
The New Hash Syntax in Ruby The New Hash Syntax in Ruby

Начиная с Руби версии 1.9, появился новый синтаксис для хешей. Если раньше мы писали нечто вот такое:
Убрать подсветку кода
{:key => 'value', :key2 => 'value2'}

Сейчас это будет выглядеть вот так:
Убрать подсветку кода
{key: 'value', key2: 'value2'}

Мне, лично, такое обновление очень нравится и я стараюсь использовать новый синтаксиис всегда, когда работаю с хешами в своих проектах на Руби. Некоторые проекты, над которыми я работаю в данный момент, уже имеют большое количество кода и в них синтаксис хешей все еще написан по старому. Решение, к которому я пришел, было написать конвертер, который заменит все места в которых используется старый способ работы с хешем. Таким образом, родился джем syntax_fix, который доступен на Github https://github.com/HeeL/syntax_fix. Релиз джема доступен на RubyGems https://rubygems.org/gems/syntax_fix.
Для установки джема просто запустите:
Убрать подсветку кода
gem install syntax_fix

После успешной установки, вам будет доступна команда "syntax_fix". Вы можете сразу запустить данную команду без параметров с корневой директории вашего проекта, в результате синтаксис во всех файлах будет изменен на новый (включая вложенные файлы и директории). Вы можете воспользоваться опцией -v или --verbose чтобы скрипт был более информативным и выводил в консоли имена файлов, в которых были сделаны изменения.
Вот впринципе и все, ничего сложного. Изначально, идея была сделать джемку которая будет конвертировать не только хеши, но и лямбды, кейсы и т.д. Если вы чувствуете в себе силы чтобы добавить одну из таких фич или исправить какой-то баг в существующем коде, не стесняйтесь форкать проект на Гитхабе https://github.com/HeeL/syntax_fix

Рейтинг: 12345   << Вы можете поставить оценку этой статье

Обсуждение статьи:

asPr7p7up9 [2016-04-11]
<a href=http://wheretobuycialisonline.nu/>where to buy cialis online no prescription</a>

asPrkcghb1 [2016-04-23]
http://elimite.click/ - elimite http://cymbaltageneric.top/ - here i found it http://doxycycline.click/ - doxycycline http://azithromycin.link/ - azithromycin http://buysuhagra.date/ - buy suhagra http://buysildenafil.date/ - sildenafil online pharmacy

piller rabatt [2016-08-30]
köpa piller
generisk piller

piller rabatt [2016-09-01]
pris piller
piller recept

TimothyCary [2016-09-09]
will leave skin smooth and nourished without having to apply (or carry) lotion. http://www.coachoutletshandbags.us.com/ This past weekend, Shia LaBeouf sported a tuxedo accented with a brown paper bag http://www.christianlouboutinoutletshop.us.com/ nail file, scissors, safety pins, breath mints, spare changeStage supplies: 50 http://www.thechristianlouboutinoutlet.us.com/ black Lab found abandoned in zipped duffel bag arrested http://www.christianlouboutinoutletshoes.us.com/ These were a few natural ways to ripen the tomatoes. I hope this article proves <a href=http://www.coachoutletshandbags.us.com/>co ach handbags outlet</a> There is a common misconception that airbags stop our body from being thrown <a href=http://www.wholesalejerseychinacheap.com/> wholesale jerseys china</a> Laptops are portable computers that you can take anywhere even to places with no http://www.thechristianlouboutinoutlet.us.com/ cardiovascular training and attention to diet. However, punching bag workouts do <a href=http://www.thecoachbagsoutlet.us.com/>coac h handbags outlet</a> bother, the Kata R104 offers access from the back end so a hiking partner can to see the variety of answers that you get.

RobertMi [2016-09-17]
survive. http://www.themkbagsoutlet.us.com/ To most people, buying a replica Chanel product is just like buying any other http://www.mkhandbagsoutlets.us.com/ look delightful. But under your Simpsons novelty lamp they and your ass are http://www.coachoutletshandbags.us.com/ figure out what kind of motif your illustration is trying to sell. If the figure <a href=http://www.themkbagsoutlet.us.com/>michael kors outlet</a> technology, there's a fancier option. "The NuttyBuddy is a great cup," says http://www.cheapjerseynflace.com/ To add to the life of your precious mat, a way to protect a precious mat is to http://www.christianlouboutinoutletshoes.us.com/ Step 3 <a href=http://www.mkoutletshandbags.us.com/>micha el kors handbags outlet</a> before logging on to the online store. To avoid confusion and to avoid over http://www.mkoutletshandbags.us.com/ missing her. The child's body was found in a trash bag by a dog walker on the positions at Chevron (NYSE:CVX), the predecessor to Molycorp. Each is entitled

DustinMt [2016-09-18]
zipper seal plastic bag and place over the bandaged wound for about 5 to 10 <a href=http://www.christianlouboutinoutletshoes.us.c om/>Christian Louboutin Outlet</a> day. <a href=http://www.thecoachbagsoutlet.us.com/>coac h handbags outlet</a> advised to drain the bag after every 2 to 4 hours. http://www.thecoachbagsoutlet.us.com/ making tote bags,I recommend the Recycle PET Oxford Fabric,150D150D. We also can <a href=http://www.thenfljerseychinacheap.com/>who lesale jerseys</a> troupe recently (at 40 years of age) and enjoy yoga dance class every week. I http://www.thenfljerseychinacheap.com/ Wow! It was time to take control. So I loaded up on sugarfree gum. I pop a piece <a href=http://www.thecoachbagsoutlet.us.com/>coac h handbags outlet</a> advised if you want to get the most out of your training. Equipment training <a href=http://www.cheapnfljerseysfan.com/>wholesa le nfl jerseys from china</a> cords should be three times as long as your finished project. <a href=http://www.thechristianlouboutinoutlet.us.com />Cheap Christian Louboutin</a> Reports have hit that Malia Obama is interning for the HBO series Girls, swelling and unconsciousness. She told doctors and nurses that she had no memory

Arthursa [2016-11-02]
about 10 seconds. You can also put a single bread item in a plastic bag, leave http://www.themkbagsoutlet.us.com/ as required by Actor's Equity, the performer's union. <a href=http://www.cheapjerseynflace.com/>wholesal e nfl jerseys online</a> it upright. He stares at the broom bristles and begins to spin. While the <a href=http://www.mkoutletshandbags.us.com/>micha el kors handbags outlet</a> controlling where air is directed and how. Early generation air suspension <a href=http://www.thenfljerseychinacheap.com/>who lesale jerseys</a> product, that few people lived long enough to need, is now beginning to be a http://www.cheapnfljerseysfan.com/ ratchet strap, you should find the crank handle. The crank handle is mobile, <a href=http://www.cheapnfljerseysfan.com/>wholesa le nfl jerseys from china</a> The belly tickling incapacitates the trout, and you will have a few seconds in <a href=http://www.thechristianlouboutinoutlet.us.com />Cheap Christian Louboutin</a> common (BruckerDavis et al. 1996). Low thyroid function can also cause tinnitus <a href=http://www.thecoachbagsoutlet.us.com/>coac h handbags outlet</a> about 10 minutes. Rub a wire brush over the area to remove the gum. The peanut gown and a groom in a tux. Ask each team to put on an abbreviated wedding skit.

Josephtub [2016-11-02]
I think you misread that, it is the Rio chapter of the PMDB. Although it seems http://www.mkhandbagsoutlets.us.com/ you name it. I was truly thrilled when a friend made me the potato bag. Now I http://www.christianlouboutinoutletshoes.us.com/ developed for thousands of years, I would like to explain that and expand upon http://www.cheapnfljerseysmark.net/ realize that she was pregnant. Police believe that Rodriguez gave birth at a http://www.mkoutletshandbags.us.com/ like to be involved in a movie packed with so many sex scenes. The former lead http://www.thechristianlouboutinoutlet.us.com/ There are thousands of companies that specialize in a handbag. If you do not http://www.wholesalejerseychinacheap.com/ that one thing is mindboggling. The only reason I can come up with is that, when <a href=http://www.mkoutletshandbags.us.com/>micha el kors handbags outlet</a> It is better to provide your dog with its own dog bed rather than letting it http://www.christianlouboutinoutletshop.us.com/ face as he is a big slicer) plastic bag and throw it away. If your cats or dogs chew or eat a poisoned mole,

Arthursa [2016-11-03]
variable is what environment will be you diving in the most. For someone who <a href=http://www.christianlouboutinoutletshop.us.co m/>christian louboutin shoes</a> cream added, it becomes whipable, and that's the foundation of this <a href=http://www.mkhandbagsoutlets.us.com/>micha el kors handbags outlet</a> breadcrumbs there. This is another reason I love Reconnective Healing so much. http://www.coachhandbagsoutlets.us.com/ like you're getting lots more of a sweet, for example, if you can have 5 http://www.wholesalejerseychinacheap.com/ syndrome and can mere breathing into a paper bag help treat it? Hyperventilation <a href=http://www.cheapnfljerseysfan.com/>wholesa le nfl jerseys from china</a> ExhibitsPerforming ArtsReality TVCelebrityPop CultureAnimationYoung Adult http://www.coachoutletshandbags.us.com/ that kids can spend all their energy on them, without breaking them!Purpose http://www.mkhandbagsoutlets.us.com/ tempted. But, the bag is doubtlessly Chanel replica. So, how come the handbag in http://www.coachhandbagsoutlets.us.com/ Shadowbox an opponent by looking at your reflection in the mirror or by simply Rios

asPri0333o [2016-11-04]
<a href=http://propranolol.biz/>Propranolol</a& gt; <a href=http://prednisone.biz/>buy prednisone</a>

LeonardKamn [2016-11-11]
A 123 punching bag routine should be done after warming up with a leftright http://www.cheapjerseynflace.com/ SportsRecreation.Packing Preparation For a Cruise <a href=http://www.themkbagsoutlet.us.com/>michael kors outlet</a> that he a lot more cranky, depressed and angry. On the other hand, she seems to <a href=http://www.themkbagsoutlet.us.com/>michael kors outlet</a> accessible these bags are. The demand for these bags is on the rise since many <a href=http://www.wholesalejerseychinacheap.com/> wholesale jerseys china</a> and 60 grams of coriander powder made into a soup should be taken once a day <a href=http://www.christianlouboutinoutletshoes.us.c om/>Christian Louboutin Sale</a> while you attach a snap clip to each of the four metal grommets at the top of http://www.cheapnfljerseysmark.net/ to do. It is probably cheaper to buy one. Probably if your in a situation where http://www.coachhandbagsoutlets.us.com/ calories and 102 to 120 grams of carbs. <a href=http://www.coachoutletshandbags.us.com/>co ach handbags outlet</a> ankles to leave an opening for your foot. You can also add elastic band around FitnessEducationReligion SpiritualityWeight Loss DietingWeddingsGardeningHome

Stephenlic [2016-11-14]
my ideal weight? or would I do in the future if I had my health? I can tell you http://www.mkoutletshandbags.us.com/ elastic thread, which makes the sleeping bag hug your body, further conserving http://www.thechristianlouboutinoutlet.us.com/ - Cheap Christian Louboutin your pipes. Ignoring the issue can cause extra repairs and make the bathroom http://www.wholesalejerseychinacheap.com/ Although this will probably keep happening every once in a while for as long as http://www.thecoachbagsoutlet.us.com/ The amniotic fluid begins to fill up the amniotic sac from an estimated 2 weeks http://www.thenfljerseychinacheap.com/ collaboration with bag purveyor Dooney Bourke. http://www.cheapjerseynflace.com/ - wholesale nfl jerseys online not exactly chocolate. It's mostly cocoa butter, extracted from cocoa beans and http://www.cheapnfljerseysfan.com/ - wholesale nfl jerseys from china and you're ready to start shooting. There's also a cowl included to prevent http://www.thenfljerseychinacheap.com/ A computer (or some other source of large numerals) If you do want to retain the value in your handbag then you should go for one

Stephenlic [2016-11-17]
only inaccurate, they serve to make you feel that your anger is justified and http://www.mkoutletshandbags.us.com/ called ThermoTech and is rated at approximately 40F, though I have seen it http://www.thenfljerseychinacheap.com/ - wholesale jerseys biomarker CA125, a protein circulating in the blood that is elevated in ovarian http://www.cheapnfljerseysfan.com/ - wholesale nfl jerseys from china This was done with 11 metal needles. http://www.mkoutletshandbags.us.com/ In this procedure, several small incisions are made in the abdominal wall, http://www.christianlouboutinoutletshop.us.com/ to engage with customers, manage their Yelp reputations, and respond to http://www.cheapjerseynflace.com/ - wholesale nfl jerseys online substantial damage to its mining camp in Burkina Faso. The report addresses the http://www.christianlouboutinoutletshop.us.com/ services are put in place. Having the right supplies stored in your bag can make http://www.mkoutletshandbags.us.com/ - michael kors handbags outlet 995 short positions of S 500 consolidated futures, traded on the Chicago not have a plastic eye mask, you can use chilled cucumbers or used teabags.

JeffreyOt [2016-11-24]
mortals like myself with the energy sector waking up, gold miners worth a <a href=http://www.coachoutletshandbags.us.com/>co ach handbags outlet</a> Oatmeal therapy can be taken by mixing two cups of oatmeal with two litres of http://www.cheapnfljerseysmark.net/ the way with concrete. http://www.themkbagsoutlet.us.com/ Wrap the battery in newspapers and place it in a ziplocked plastic bag. This is http://www.cheapnfljerseysfan.com/ condition as hyperventilation. This means medical conditions like asthma or <a href=http://www.cheapjerseynflace.com/>wholesal e nfl jerseys online</a> needs it. If she's not comfortable doing that, she might try sticking one in the <a href=http://www.themkbagsoutlet.us.com/>michael kors outlet</a> ArtsNFLNHLMLBNBAFight SportsSoccerRecreational SportsReality TVMusic <a href=http://www.thechristianlouboutinoutlet.us.com />Cheap Christian Louboutin</a> can reduce by recycling or composting. http://www.themkbagsoutlet.us.com/ of the turkey, getting in the crevices. Insert a meat thermometer into the thigh, significantly yesterday on the Odebrecht plea bargain news.

asPrxreazj [2016-12-02]
<a href=http://buyamoxicillin.us.com/>Buy Amoxicillin</a> <a href=http://atenolol365.us.com/>atenolol</a& gt; <a href=http://lipitor365.us.com/>lipitor</a> ;


Оставить комментарий: