The Basics of Object Orientation Ruby

class Tesla#your code hereend
class Tesla#your code hereendmodel3 =<Tesla:0x000055b1e0d41df8>
class Tesla#your code hereend model3 = Tesla.newmodel3.methods =>
[:to_json, :instance_variable_set, :instance_variable_defined?, :remove_instance_variable, :instance_of?, :kind_of?, :is_a?, :tap, :instance_variable_get, :public_methods, :instance_variables, :method, :public_method, :singleton_method, :define_singleton_method, :public_send, :extend, :to_enum, :enum_for, :pp, :<=>, :===, :=~, :!~, :eql?, :respond_to?, :freeze, :inspect, :object_id, :send, :to_s, :display, :nil?, :hash, :class, :singleton_class, :clone, :dup, :itself, :yield_self, :taint, :untaint, :tainted?, :untrusted?, :untrust, :frozen?, :trust, :singleton_methods, :methods, :private_methods, :protected_methods, :!, :equal?, :instance_eval, :==, :instance_exec, :!=, :__id__, :__send__]
class Tesla    def ignition     
puts "The Tesla is now turned on"
endmodel3 =
The Tesla is now turned on
class Tesla   def name=(car_name)
@this_cars_name = car_name

def name
endmodel3 = = "Optimus"
=> nil

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Disaster Recovery Strategy for Elasticsearch

MakerDAO: Everything Governance for March 2022

Top Python Libraries for Data Science

Avalara Tax Integration with Microsoft Dynamics 365 for Sales

How I Got Into Coding

Korean Tokenization & Lemmatization

Seeking Concinnity in Coding Conventions


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Arslan Ali

Arslan Ali

More from Medium

How to give meaningful names in code?

Complicating my existence: story of my life (as a Software Developer)

How to Seed Random Data with Faker — Ruby/Rails

Code Smarter; Use a Debugger