Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Bond with IRB #276

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion iruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Gem::Specification.new do |s|

s.required_ruby_version = '>= 2.3.0'

s.add_dependency 'bond', '~> 0.5'
s.add_dependency 'data_uri', '~> 0.1'
s.add_dependency 'ffi-rzmq'
s.add_dependency 'mimemagic', '~> 0.3'
Expand Down
13 changes: 8 additions & 5 deletions lib/iruby/backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,20 @@ class PlainBackend
prepend History

def initialize
require 'bond'
Bond.start(debug: true)
@eval_path = '(iruby)'
require 'irb'
require 'irb/completion'
IRB.setup(nil)
@irb = IRB::Irb.new
IRB.conf[:MAIN_CONTEXT] = @irb.context
end

def eval(code, store_history)
TOPLEVEL_BINDING.eval(code, @eval_path, 1)
@irb.context.evaluate(code, 0)
@irb.context.last_value
end

def complete(code)
Bond.agent.call(code, code)
IRB::InputCompletor::CompletionProc.call(code)
end
end

Expand Down
5 changes: 5 additions & 0 deletions lib/iruby/ostream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def writelines(lines)
lines.each { |s| write(s) }
end

# Called by irb
def set_encoding(extern, intern)
a = extern
end

private

def build_string
Expand Down