aris
#1
Hello,
How can i express the attributes methods using normal method styles (the
long coding way) to define them?
attr_accessor :name
attr_writer :name
attr_reader :legs, :arms
My own try is below. If I’m wrong, then correct it for me by re-typing
it.
My answer is:
def name=(name)
@name = name
end
def name=(legs,arms)
@name = legs, arms
end
def name
@name
end
Thank you!
rubina
#2
On 27/07/2012, at 1:09 PM, Ruby S. wrote:
How can i express the attributes methods using normal method styles (the
long coding way) to define them?
attr_accessor :name
attr_writer :name
attr_reader :legs, :arms
These are the equivalent of…
attr_accessor :name
def name= value
@name = value
end
def name
@name
end
attr_writer :name
def name= value
@name = value
end
attr_reader :legs, :arms
def legs
@legs
end
def arms
@arms
end
Henry
rubina
#3
Henry M. wrote in post #1070351:
On 27/07/2012, at 1:09 PM, Ruby S. wrote:
Thank you for the great answer 