module Noty::Helpers

Public Instance Methods

copy(text) click to toggle source
# File lib/noty/helpers.rb, line 12
def copy(text)
  case RUBY_PLATFORM
  when /darwin/
    Open3.capture2('pbcopy', stdin_data: text)
  when /linux/
    Open3.capture2('xsel --clipboard --input', stdin_data: text)
  end
end
edit(file_path) click to toggle source
# File lib/noty/helpers.rb, line 7
def edit(file_path)
  editor = ENV['EDITOR'] || 'vi'.freeze
  system "#{editor} #{file_path}"
end
open_url(url) click to toggle source
# File lib/noty/helpers.rb, line 21
def open_url(url)
  case RUBY_PLATFORM
  when /darwin/
    system "open #{url}"
  when /linux/
    system "xdg-open #{url}"
  end
end