Class Installer::Shebang
In: setup.rb
Parent: Object

Methods

load   new   parse   to_s  

Attributes

args  [R] 
cmd  [R] 

Public Class methods

[Source]

# File 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

[Source]

# File setup.rb, line 1323
    def initialize(cmd, args = [])
      @cmd = cmd
      @args = args
    end

[Source]

# File setup.rb, line 1318
    def Shebang.parse(line)
      cmd, *args = *line.strip.sub(/\A\#!/, '').split(' ')
      new(cmd, args)
    end

Public Instance methods

[Source]

# File setup.rb, line 1331
    def to_s
      "#! #{@cmd}" + (@args.empty? ? '' : " #{@args.join(' ')}")
    end

[Validate]