Ruby we might Miss

August 9, 2011

0

This is the continuation part of the series I started. The topic for this post : Module —————————————————————————————————————— • Module#remove_method removes a method from the specified class. Module#undef_method, on the other hand, actively prevents that method from being invoked on the class; it inserts a special entry into the m_tbl that stops method lookup. —————————————————————————————————————— […]

Posted in: Ruby

Ruby we might Miss

August 9, 2011

0

This is the continuation of the series I started. The topic for this post : Kernel —————————————————————————————————————— • Kernel#Array tries to coerce its argument into an array: Array([1,2,3]) # => [1, 2, 3] Array(1..3) # => [1, 2, 3] Array(1) # => [1] ——————————————————————————————————————

Posted in: Ruby

Ruby we might Miss

August 9, 2011

0

This is the continuation of the series I started. The topic for this post : Hash —————————————————————————————————————— • Hash.new accepts a block, which provides a way to calculate a default value if the hash has none. This is useful for caching. The first time a cached method is called with a particular set of arguments, […]

Posted in: Ruby

Ruby we might Miss

August 9, 2011

0

This is the third part of the series I started. The topic for this post : File ———————————————————————————————————— • File.join(*parts) is a platform-independent way to join path segments: File.join(“..”, “test.rb”) # => “../test.rb” ———————————————————————————————————— ———————————————————————————————————— •File.open can take a block, which will automatically close the file when exited. ————————————————————————————————————

Posted in: Ruby

Ruby we might Miss

August 9, 2011

0

This is the third part of the series I started. The topic for this post : Enumerable ———————————————————————————————————— • Enumerable#all? returns true if the given block returns a true value for all items in the enumerable. Similarly, Enumerable#any? returns true if the block returns a true value for any item. (1..10).all?{|i| i > 0 && […]

Posted in: Ruby

Ruby we might Miss

August 9, 2011

0

Hi, This is the second part of the series I started in the last post. The topic for this post : DIR. ———————————————————————————————————————————– Dir.[] is shorthand for Dir.glob: Dir[“/s*”] # => [“/scripts”, “/srv”, “/selinux”, “/sys”, “/sbin”] ———————————————————————————————————————————–

Posted in: Ruby

Ruby we might Miss

August 9, 2011

0

Hi. This is a small series of posts about some everyday ruby we might miss but is very important. I am going through Advanced Rails book. I will be posting what I find very interesting !! Every post will cover a major class: Topic for this post : Array. (Sorry for poor formatting !! ) […]

Posted in: Ruby