From: Leon Bogaert Date: 2008-05-29T06:01:30+09:00 Subject: Calling instance method when module included Hi all, Maybe a silly question, but is it possible to call instance methods on an object when you've included a module? Or maybe I'm having the wrong approach and somebody can point me in the right direction? I'm now doing something like: a = ['one', 'two', 'three'] a.send(:include, InstanceMethods) And the InstanceMethods module looks like: module InstanceMethods def self.included(base) base.instance_eval do self.each do |item| p item end end end end Now I'm getting everytime: NoMethodError: undefined method `each' for Array:Class So my question: is a construction like this possible? If yes, how then? If no: is there a better way to achieve this then? Or should I drop the idea and first include the module and THEN create the object? In this context it's maybe a bit silly, but I didn't want to post the code in which I'm trying to use this construct because then it maybe distracts from the idea I'm trying to achieve. Thanks in advance all! -- Posted via http://www.ruby-forum.com/.