The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Simpler Ways

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Red Handed

Posts: 1158
Nickname: redhanded
Registered: Dec, 2004

Red Handed is a Ruby-focused group blog.
Simpler Ways Posted: Jul 15, 2005 1:21 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Red Handed.
Original Post: Simpler Ways
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Red Handed
Latest Posts From RedHanded

Advertisement

1. Less explicit to_s.

Like in joining arrays: records.map { |r| r.to_s }.join "\n"

Agg, get away casting! Could just be: records * "\n"

2. Forgetting grep works with classes.

I’ll be searching for a class: animals.find_all { |a| a.is_a? Hawk }

Rather: animals.grep Hawk

3. Structs for simple classes.

Object still needs an attrs method. Struct has members.

Object uses instance_variable_set. Struct uses []=.

Read: Simpler Ways

Topic: Weird weight gains and losses Previous Topic   Next Topic Topic: EPSON chooses Rails for developer site

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use