Skip to content

Commit

Permalink
Fix irb includes
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Clayton committed Jul 4, 2009
1 parent fb27fa4 commit 6095a57
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions irbrc
@@ -1,11 +1,11 @@
require 'rubygems' require "rubygems"


def require_rb_files_from(dir) def require_rb_files_from(dir)
Dir.glob(File.join(dir, '*.rb')) do |file| Dir.glob(File.join(dir, "*.rb")) do |file|
require file require file
end end
end end


require_rb_files_from(File.join(ENV['HOME'], '.irb_scripts.d')) require_rb_files_from(File.join(ENV["HOME"], ".irbrc.d"))


IRB.conf[:PROMPT_MODE] = :SIMPLE IRB.conf[:PROMPT_MODE] = :SIMPLE
2 changes: 1 addition & 1 deletion irbrc.d/completion.rb
@@ -1 +1 @@
require 'irb/completion' require "irb/completion"
2 changes: 1 addition & 1 deletion irbrc.d/core_extensions.rb
Expand Up @@ -12,6 +12,6 @@ def self.file_to_string(path)
def self.string_to_file(string, path) def self.string_to_file(string, path)
directory = File.dirname(path) directory = File.dirname(path)
FileUtils.mkdir_p directory unless File.directory?(directory) FileUtils.mkdir_p directory unless File.directory?(directory)
File.open(path, 'w') { |f| f << string } File.open(path, "w") { |file| file << string }
end end
end end
6 changes: 3 additions & 3 deletions irbrc.d/history.rb
Expand Up @@ -2,7 +2,7 @@


module Readline module Readline
module History module History
LOG = "#{ENV['HOME']}/.irb-save-history" LOG = "#{ENV["HOME"]}/.irb-save-history"
def self.write_log(line) def self.write_log(line)
File.open(LOG, 'ab') {|f| f << "#{line}\n"} unless line == "exit" File.open(LOG, 'ab') {|f| f << "#{line}\n"} unless line == "exit"
end end
Expand All @@ -19,6 +19,6 @@ def readline(*args)
end end
end end


require 'irb/ext/save-history' require "irb/ext/save-history"
IRB.conf[:SAVE_HISTORY] = 100 IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history" IRB.conf[:HISTORY_FILE] = "#{ENV["HOME"]}/.irb-save-history"
4 changes: 3 additions & 1 deletion irbrc.d/snip.rb
Expand Up @@ -9,7 +9,9 @@ def self.create(name, &blk)
end end


def self.[](name) def self.[](name)
raise SnippetNotFoundError, "the snippet '#{name.to_s}' was not found" unless @@snips.has_key?(name.to_s) unless @@snips.has_key?(name.to_s)
raise SnippetNotFoundError, "the snippet '#{name.to_s}' was not found"
end
@@snips[name.to_s].call @@snips[name.to_s].call
end end


Expand Down

0 comments on commit 6095a57

Please sign in to comment.