Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7065223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:55:48+00:00 2026-05-28T04:55:48+00:00

def load_lib path = File.join(File.dirname(__FILE__), ‘lib’) failures = [] Dir.glob(#{path}/**/*.rb).each { |file| puts loading:

  • 0
def load_lib
    path = File.join(File.dirname(__FILE__), 'lib')
    failures = []
    Dir.glob("#{path}/**/*.rb").each {  |file|
        puts "loading: #{file} ... "
    }
end 

There’s the script. When I put each line in individually, the load_lib function is available and works fine. But when I paste it into irb in one big chunk (Ubuntu terminal, Sh Ctrl C) it freaks out at the Dir.glob(... line and shows this:

Display all 931 possibilities? (y or n)
!
!=
!~
<=>
.... [dozens of lines in this vein]

and then the method isn’t created at all.

Here’s what happens (success) when I paste it in one line at a time:

>>  def load_lib
>>     path = File.join(File.dirname(__FILE__), 'lib')
>>     failures = []
>> Dir.glob("#{path}/**/*.rb").each {  |file|
?> puts file
>> }
>> end
=> nil
>> load_lib
./lib/alpha_processor.rb
./lib/development_mail_interceptor.rb
./lib/service_processors/beta_processor.rb

Is there something about the [] or {} that irb doesn’t like when they are pasted in?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:55:49+00:00Added an answer on May 28, 2026 at 4:55 am

    That’s because of TAB characters you have in your source file. Indent with spaces. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

def initialize(apps, catch=404) @apps = []; @has_app = {} apps.each { |app| add app
I have a gem: # in /Library/Ruby/Gems/1.8/gems/my_gem-1.0.0/lib/my_gem.rb module MyGem def do_stuff .. end end
I have the following code class SomeClass def initialize(opts) if opts[:should_load] load else setup(opts[:path])
I'm not sure what I'm doing wrong here, I have a file in lib/acts_as_votable.rb
def foo (): x = re.compile('^abc') foo2(x) def foo2(x): How do I get x
def update @album = Album.find(params[:id]) if @album.update_attributes(params[:album]) redirect_to(:action=>'list') else render(:action=>'edit') end end A Rails
def partial(template, *args) options = args.extract_options! options.merge!(:layout => false) if collection = options.delete(:collection) then
def test_method [a, b, c].map {|i| yield(i) } end If I call test_method like
def self.get(server) return unless server server = server.to_s if klass = @handlers[server] obj =
def any? if block_given? method_missing(:any?) { |*block_args| yield(*block_args) } else !empty? end end In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.