Head First Ruby by Jay McGavren

Head First Ruby by Jay McGavren

Author:Jay McGavren
Language: eng
Format: epub, mobi, pdf
Tags: COMPUTERS / Programming Languages / Ruby
ISBN: 9780596559618
Publisher: O'Reilly Media
Published: 2015-08-21T04:00:00+00:00


Well, if we had done it that way, the initialize method would work just fine...at first.

The initialize method gets mixed into the Photo class, and it gets called when we call Photo.new. It sets the @comments instance variable to an empty array, before the comments reader method is ever called.

Using an initialize method in our module works...until we add an initialize method to one of the classes we’re mixing it into.

Suppose we needed to add an initialize method to our Photo class, to set a default format:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.