Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Showed how to access from an instance method

  • Loading branch information...
commit 57c445a9d4f23b1b744c3dd06d3e7f1a85311441 1 parent 38dc427
@iainbeeston iainbeeston authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 chapters/classes_and_objects/class-variables.md
View
5 chapters/classes_and_objects/class-variables.md
@@ -13,6 +13,9 @@ You want to create a class variable.
class Zoo
@MAX_ANIMALS: 50
MAX_ZOOKEEPERS: 3
+
+ helpfulInfo: =>
+ "Zoos may contain a maximum of #{@constructor.MAX_ANIMALS} animals"
Zoo.MAX_ANIMALS
# => 50
@@ -23,6 +26,8 @@ Zoo.MAX_ZOOKEEPERS
zoo = new Zoo
zoo.MAX_ZOOKEEPERS
# => 3
+zoo.helpfulInfo()
+# => "Zoos may contain a maximum of 50 animals"
{% endhighlight %}
## Discussion
Please sign in to comment.
Something went wrong with that request. Please try again.