class String

Public Instance Methods

dir?() click to toggle source
# File lib/rush/string_ext.rb, line 9
def dir?
  ::Dir.exists? self
end
e(meth, *args, &block)
Alias for: open_with
executables() click to toggle source
# File lib/rush/string_ext.rb, line 30
def executables
  Rush::Path.executables
end
less() click to toggle source
# File lib/rush/string_ext.rb, line 4
def less
  IO.popen('less -R', 'w') { |f| f.puts self }
end
Also aliased as: pager
locate() click to toggle source
# File lib/rush/string_ext.rb, line 13
def locate
  Rush::Dir.new(ENV['HOME']).locate self
end
open_with(meth, *args, &block) click to toggle source
# File lib/rush/string_ext.rb, line 17
def open_with(meth, *args, &block)
  if executables.include? meth.to_s
    system [meth.to_s, *args, self].join(' ')
  else
    raise 'No such executable. Maybe something wrong with PATH?'
  end
end
Also aliased as: e
pager()
Alias for: less
|(meth, *args, &block) click to toggle source
# File lib/rush/string_ext.rb, line 26
def |(meth, *args, &block)
  Open3.capture2(meth, stdin_data: self).first
end