Library, module, or...?

i have a class i'm working on:

class Myclass
        def initialize()
        end

       def usefulmethod1()
       end

      def usefulmethod2()
end

it's currently over 100 lines and will probably be double that.

what's the most efficient way of turning that into a library or
module.

i'm guessing it can't be module because of the initialize method...

Hi --

i have a class i'm working on:

class Myclass
        def initialize()
        end

       def usefulmethod1()
       end

      def usefulmethod2()
end

it's currently over 100 lines and will probably be double that.

what's the most efficient way of turning that into a library or
module.

i'm guessing it can't be module because of the initialize method...

Sure it can -- you just have to 'include' it in a class (i.e., you
can't instantiate the module, but you can still house an initialize
method in it for use by classes):

  module M
    def initialize
      puts "hi"
    end
  end

  class C
    include M
  end

  C.new # => hi

David

···

On Fri, 11 Jun 2004, tony summerfelt wrote:

--
David A. Black
dblack@wobblini.net

ah, where to initialize everything that used to be in the class was
the missing piece of the puzzle for me...

the more i dig into ruby the more i like it...

according to the various things i've read via google, installing third
party modules should go into: site_ruby\1.8 ? that's what i'm
currently doing with my own code (although stuff i've installed has
gone lib\ruby\1.8

i want include a proper installer.rb/gui installer for my module

···

On Fri, 11 Jun 2004 04:31:35 +0900, you wrote:

Sure it can -- you just have to 'include' it in a class (i.e., you
can't instantiate the module, but you can still house an initialize
method in it for use by classes):

module M
   def initialize
     puts "hi"
   end
end

class C
   include M
end

C.new # => hi

according to the various things i've read via google, installing third
party modules should go into: site_ruby\1.8 ? that's what i'm
currently doing with my own code (although stuff i've installed has
gone lib\ruby\1.8

Look at setup.rb, you can find it here:

http://raa.ruby-lang.org/list.rhtml?name=setup

Also, look at RubyGems, since they seem to be up-and-coming RSN:

http://rubygems.rubyforge.org/wiki/wiki.pl

i want include a proper installer.rb/gui installer for my module

I don't believe a generic GUI installer has been created. Both setup.rb
and RubyGems can easily install your module.

···

tony summerfelt (snowzone5@hotmail.com) wrote:

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

will look at both of those. i was going to create both a windows
specific gui installer, but the more i think about it, anybody
programming in ruby is going to be familiar with the command line
anyway...

···

On Sat, 12 Jun 2004 04:00:18 +0900 Fri, 11 Jun 2004 12:00:07 -0700, you wrote:

Look at setup.rb, you can find it here:

http://rubygems.rubyforge.org/wiki/wiki.pl

I don't believe a generic GUI installer has been created. Both setup.rb
and RubyGems can easily install your module.