Aaron D. Gifford wrote in post #992841:
> What do you do when you see a need to be able to attach some data to
> an object instance for later use somewhere else in a body of code?
...
> require 'ostructmod'
> class OpenSSL::PKey
>   include OpenStructModule
> end

You probably wouldn't want OpenStructModule even if it did exist because 
you wouldn't want NoMethodError to be suppressed. Perhaps you're looking 
for Object#extend.

  module UserId
    attr_accessor :user_id
  end
  thing = Object.new  # whatever the thing is
  thing.extend(UserId).user_id = 123456
  p thing.user_id  #=>123456

-- 
Posted via http://www.ruby-forum.com/.