mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Introduce inspect
This commit is contained in:
parent
6efba3485e
commit
a51eb67742
3
ruby.md
3
ruby.md
@ -558,6 +558,9 @@ dwight.name #=> "Dwight K. Schrute"
|
|||||||
# Calling of a class method
|
# Calling of a class method
|
||||||
Human.say('Hi') #=> "Hi"
|
Human.say('Hi') #=> "Hi"
|
||||||
|
|
||||||
|
# Tip: Use .inspect to see instance with instance variables
|
||||||
|
puts jim.inspect #=> #<Human:0x000058b3c7f0c7a0 @name="Jim Halpert", @age=0>
|
||||||
|
|
||||||
# Variable's scopes are defined by the way we name them.
|
# Variable's scopes are defined by the way we name them.
|
||||||
# Variables that start with $ have global scope.
|
# Variables that start with $ have global scope.
|
||||||
$var = "I'm a global var"
|
$var = "I'm a global var"
|
||||||
|
Loading…
Reference in New Issue
Block a user