O
Oliver Saunders
I've got this class that is essentially an array with a few things
added. Here's some of it:
class Pages
def initialize
@content = []
end
def import(file, page_delimiter = '')
@content = file.read.split page_delimiter
self
end
def [](num)
@content[num]
end
def <<(page_content)
@content << page_content
end
....
Because I'm basically reimplementing Array I thought it might me more
sense to inherit from Array or delegate to Array. The trouble is that I
need to assign to @content. How do you suggest I get round this problem?
added. Here's some of it:
class Pages
def initialize
@content = []
end
def import(file, page_delimiter = '')
@content = file.read.split page_delimiter
self
end
def [](num)
@content[num]
end
def <<(page_content)
@content << page_content
end
....
Because I'm basically reimplementing Array I thought it might me more
sense to inherit from Array or delegate to Array. The trouble is that I
need to assign to @content. How do you suggest I get round this problem?