Re: case vs if-else

2012-08-16 Thread Robert Klemme
On Thu, Aug 16, 2012 at 4:46 PM, Jan E. wrote: > It looks like you're made for each other. :-D Hey, don't uncover our little secret! Darn... robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/ -- You received this message because you are subscrib

Re: Manipulating functions-runtime

2012-08-16 Thread Robert Klemme
On Thu, Aug 16, 2012 at 3:51 PM, ajay paswan wrote: > suppose > var="world" > I want to call a method called hello_world() using the variable var. How > to do that in ruby? > and what feature of programing is this called?suppose > var="world" > I want to call a method called hello_world() using th

Re: case vs if-else

2012-08-16 Thread Robert Klemme
On Thu, Aug 16, 2012 at 4:23 PM, ajay paswan wrote: > Robert Klemme wrote in post #1072532: >> On Thu, Aug 16, 2012 at 1:43 PM, ajay paswan >> wrote: >>> Which one is faster? >> >> Measure it. There is Benchmark. >> > means? what measure? and who'll measure? You want to know which one is faster

Re: extending class, namespace question

2012-08-16 Thread Robert Klemme
On Thu, Aug 16, 2012 at 2:16 PM, Ronnie Aa wrote: > I have this: > > class Fixnum >def times_print(str) > times { puts str } >end > end > > module Bb > def self.test > 10.times_print('foo') > end > test > end > > It works.. > > But if some other .rb uses the same name for its

Re: case vs if-else

2012-08-16 Thread Robert Klemme
On Thu, Aug 16, 2012 at 1:43 PM, ajay paswan wrote: > Which one is faster? Measure it. There is Benchmark. > for example: > > if grade=="A" > puts("you are smart") > elsif grade=="F" > puts("you are dumb") > end > ###Vs > case grade > when "A" > puts("you are smart