On Oct 22, 5:15 pm, John Small <[EMAIL PROTECTED]>
wrote:
> While I'm in a script/console session I want access to methods I've
> defined in a utilities unit I've put in the project/lib directory. I've
> tried requiring the unit and loading the unit but still don't get the
> methods. What's the technique to use in this case?
> --
> Posted viahttp://www.ruby-forum.com/.
Put them into a module.
For instance, I have lib/image_handler.rb.
module ImageHandler
def self.foo
puts 'foo'
end
class Image
...
end
....
end
$ script/console
Loading development environment (Rails 2.0.2)
>> ImageHandler
=> ImageHandler
>> ImageHandler::Image
=> ImageHandler::Image
>> ImageHandler.foo
=> "foo"
--
Daniel Bush
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---