[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

replace my symbolobject

Junkone

8/11/2006 1:31:00 PM

I havea symbolobject which i use as a array later. the definition is
class SymbolObject

def initialize(symb)
puts symb
@symbol=symb

@name=@exchange=@news=@summary=@sector=@industry=@category=@otherInfo=@optionsData=@scanType=@scLink=''
@markedBad=false
end
attr_accessor :symbol,:name ,:exchange, :news, :summary, :sector,
:industry,:category,:markedBad,:scanType,:otherInfo,:optionsData,:scLink;
def to_s
return @symbol + @news + @exchange + @name
end
def <=>(other)
return [@symb, @name, @exchange] <=> [other.symb, other.name,
other.exchange]
end


end

Issuethat i see
1. As i create a symbol object, i add it to a array. However i have no
means of sorting the symbol objects based on its properties or use
indexed seeks etc.
2. how to i either enhance the symbolobject or replace it with
somethingelse that provides a object like view but can be indexed and
sorted. Is there a collection object or Record object in ruby. i am
open for any other options.