Class: Installer::Shebang
- Inherits:
-
Object
- Object
- Installer::Shebang
- Defined in:
- lib/mime-types-1.16/setup.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#cmd ⇒ Object
readonly
Returns the value of attribute cmd.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cmd, args = []) ⇒ Shebang
constructor
A new instance of Shebang.
- #to_s ⇒ Object
Constructor Details
#initialize(cmd, args = []) ⇒ Shebang
1323 1324 1325 1326 |
# File 'lib/mime-types-1.16/setup.rb', line 1323 def initialize(cmd, args = []) @cmd = cmd @args = args end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
1329 1330 1331 |
# File 'lib/mime-types-1.16/setup.rb', line 1329 def args @args end |
#cmd ⇒ Object (readonly)
Returns the value of attribute cmd.
1328 1329 1330 |
# File 'lib/mime-types-1.16/setup.rb', line 1328 def cmd @cmd end |
Class Method Details
.load(path) ⇒ Object
1309 1310 1311 1312 1313 1314 1315 1316 |
# File 'lib/mime-types-1.16/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 |
.parse(line) ⇒ Object
1318 1319 1320 1321 |
# File 'lib/mime-types-1.16/setup.rb', line 1318 def Shebang.parse(line) cmd, *args = *line.strip.sub(/\A\#!/, '').split(' ') new(cmd, args) end |
Instance Method Details
#to_s ⇒ Object
1331 1332 1333 |
# File 'lib/mime-types-1.16/setup.rb', line 1331 def to_s "#! #{@cmd}" + (@args.empty? ? '' : " #{@args.join(' ')}") end |