Take this for example:
class Inner
attr_accessor :id, :number
def initialize(id, number)
@id = id
@number = number
end
def id()
return @id + "_" @number
end
end
class Outer
attr_accessor :id, :inner, :another
def initialize(id, inner, another)
@id = id
@inner = inner # instance variable for class Inner object
@another = another
end
def id()
return "Outer id:\n"
+ @id + "\nInner : " + @inner.id() +"\nAnother: " + @another + "\n"
end
end
When I call the id() function of an "Outer" object, the output stops at "\nInner : ". How do I get around this? Thank you.
+in the Inner's id method's return ->return @id + "_" + @number