class Installer::Shebang

Attributes

args[R]
cmd[R]

Public Class Methods

load(path) click to toggle source
# File pkg/statsample-1.4.0/setup.rb, line 1309
def Shebang.load(path)
  line = nil
  File.open(path) {|f|
    line = f.gets
  }
  return nil unless /\A#!/ =~ line
  parse(line)
end
new(cmd, args = []) click to toggle source
# File pkg/statsample-1.4.0/setup.rb, line 1323
def initialize(cmd, args = [])
  @cmd = cmd
  @args = args
end
parse(line) click to toggle source
# File pkg/statsample-1.4.0/setup.rb, line 1318
def Shebang.parse(line)
  cmd, *args = *line.strip.sub(/\A\#!/, '').split(' ')
  new(cmd, args)
end

Public Instance Methods

to_s() click to toggle source
# File pkg/statsample-1.4.0/setup.rb, line 1331
def to_s
  "#! #{@cmd}" + (@args.empty? ? '' : " #{@args.join(' ')}")
end