Class names in arrays

Discussion in 'Ruby' started by Benjamin Fowl, Mar 24, 2011.

  1. Is it a bad idea to use class names in a hash?

    eg

    coll = [EcoCalendar,MarketForecast]

    --
    Posted via http://www.ruby-forum.com/.
     
    Benjamin Fowl, Mar 24, 2011
    #1
    1. Advertising

  2. On Thu, Mar 24, 2011 at 11:22 AM, Benjamin Fowl <> wrote:
    > Is it a bad idea to use class names in a hash?
    >
    > eg
    >
    > coll = [EcoCalendar,MarketForecast]


    Not per se, depends on what you are going to do with them. By the way,
    that's not a hash, it's an array:

    ruby-1.8.7-p334 :001 > [String,Time].class
    => Array

    Can you give us more information?

    Jesus.
     
    Jesús Gabriel y Galán, Mar 24, 2011
    #2
    1. Advertising

  3. Hi,

    Am 24.03.2011 11:22, schrieb Benjamin Fowl:
    > Is it a bad idea to use class names in a hash?
    >
    > eg
    >
    > coll = [EcoCalendar,MarketForecast]


    generally speaking, there is no correct answer for that question. It
    depends on your context.
    If it fits yours solution, it's absolutely ok.

    Waldemar
     
    Waldemar Dick, Mar 24, 2011
    #3
  4. On Thu, Mar 24, 2011 at 11:22 AM, Benjamin Fowl <> wrote:
    > Is it a bad idea to use class names in a hash?
    >
    > eg
    >
    > coll = [EcoCalendar,MarketForecast]


    Where's the Hash? Or did you mean [EcoCalendar,MarketForecast].hash ?

    Cheers

    robert

    --
    remember.guy do |as, often| as.you_can - without end
    http://blog.rubybestpractices.com/
     
    Robert Klemme, Mar 24, 2011
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paddy McCarthy
    Replies:
    3
    Views:
    720
    Anthony J Bybell
    Sep 24, 2004
  2. Bob
    Replies:
    1
    Views:
    389
    Lucas Tam
    Jul 30, 2004
  3. E11
    Replies:
    1
    Views:
    4,792
    Thomas Weidenfeller
    Oct 12, 2005
  4. Ares Lagae
    Replies:
    8
    Views:
    451
    Ares Lagae
    Sep 24, 2004
  5. Philipp
    Replies:
    21
    Views:
    1,135
    Philipp
    Jan 20, 2009
Loading...

Share This Page