2009/4/16 Sijo Kg <sijo / maxxion.com>:
> Hi
> =A0 =A0 I have
>
> =A0 =A0def get_company_details_array
> =A0 =A0c =3D nil
> =A0 =A0arr =3D [] if c.nil?
> =A0 =A0c.nil? ? =A02.times {arr.push("")} :['a','b']
> =A0end

What weird logic is that? Basically you can replace the method with

def get_company_details_array
  ['','']
end

> =A0arr =3D ['abc'] + get_company_details_array
> =A0puts arr.inspect
>
> =A0 What I expected here is ["abc","",""] =A0 But I am getting error
> array.rb:7:in `+': can't convert Fixnum into Array (TypeError)
> =A0 =A0 =A0 =A0from array.rb:7
>
> =A0 =A0 =A0 =A0 Could anybody please correct the code?

Hint: Fixnum#times returns the number.

Cheers

robert

--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/