Attr_accessor:
While initializing object you can assign the value to it. Check the following example and practice it.
- class Person
- attr_accessor :name
- def initialize(name)
- self.name = name
- end
- end
- person = Person.new("Andreas")
- puts person.name
- person.name = "David"
- puts person.name
- Hope you will practice it, i will get back to you with new concept.
Ruby tutorial session 5
Subscribe to:
Posts (Atom)
My Experience in RUBYCONF INDIA 2016
Hi Readers, Rubyconf India is a global event complementing other RubyConf events across the world. I attended this event held on 19-20 ma...
-
Hi Amigos, Today i would like to share something which i achieved today. There is one Post i saw few days back in Facebook. What th...
-
Hi Readers, Rubyconf India is a global event complementing other RubyConf events across the world. I attended this event held on 19-20 ma...
-
Everything is an Object: 2 + 2 is equivalent to 2+(2) and 2.send(:+, 2) 2.hours.ago 2.class # => Fixnum 2.class.instance_methods...
No comments:
Post a Comment