Class: IRB::Kit::Handlers::Paster

Inherits:
Abstract
  • Object
show all
Defined in:
lib/irb/kit/handlers/paster.rb

Overview

Handles pasting content from the macOS clipboard.

Instance Method Summary collapse

Constructor Details

#initialize(processor: IO) ⇒ Paster

Returns a new instance of Paster.



8
9
10
11
# File 'lib/irb/kit/handlers/paster.rb', line 8

def initialize(processor: IO, **)
  @processor = processor
  super(**)
end

Instance Method Details

#callObject



13
14
15
16
17
# File 'lib/irb/kit/handlers/paster.rb', line 13

def call
  processor.popen "pbpaste", "r", &:read
rescue Errno::ENOENT
  io.puts "ERROR: Unable to paste since `pbpaste` is only supported on macOS."
end