Created
August 20, 2021 09:49
-
-
Save vamsipavanmahesh/a5328b9ac60b3241ce1b7aa9609714db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):016:1* class Car | |
irb(main):017:1* attr_accessor :model | |
irb(main):018:1* | |
irb(main):019:2* def pretty_name | |
irb(main):020:2* model + " pretty" | |
irb(main):021:1* end | |
irb(main):022:0> end | |
=> :pretty_name | |
irb(main):023:0> c1 = Car.new | |
=> #<Car:0x00007ff7598f1aa8> | |
irb(main):024:0> c1.model = "c1" | |
=> "c1" | |
irb(main):025:0> c1.pretty_name | |
=> "c1 pretty" | |
irb(main):026:0> c2 = Car.new | |
=> #<Car:0x00007ff759941cb0> | |
irb(main):027:0> c2.model = "c2 model" | |
=> "c2 model" | |
irb(main):028:0> c2.pretty_name | |
=> "c2 model pretty" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment