From: Francesco Rodriguez Date: 2011-12-12T04:31:15+09:00 Subject: Re: How to call a method from a different class --0016367b6daa93807f04b3d60f7d Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 1 module Checkout 2 extend self 3 4 def overall_method 5 "overall total #{self.class}" 6 end 7 end 8 9 class Shopping 10 include Checkout 11 12 def order 13 puts overall_method 14 puts Checkout.overall_method 15 end 16 end overall total Shopping overall total Module I just tried this and works D: I was trying to define one method that i can use as a class and instance one. PD: I have to see more often this list :) 2011/12/11 Peter Vandenabeele > On Sun, Dec 11, 2011 at 2:32 PM, jake kaiden wrote= : > > > hey folks, > > > > class methods are defined with `self.foo` rather than `class.foo` - so > > that > > > > def class.overall_class_method > > "overall total on class" > > end > > > > should be written: > > > > def self.overall_class_method > > "overall total on class" > > end > > > > Sorry for the confusion ... (hits hammer on head: _always_ test code befo= re > posting) > > Peter > --=20 * Francesco Rodr=EDguez * ** * @frodsan https://github.com/frodsan ** http://frodsan.wordpress.com/ * * * --0016367b6daa93807f04b3d60f7d--