Module: SimpleTemplater::Helpers

Extended by:
Helpers
Included in:
Helpers
Defined in:
lib/simple-templater/helpers.rb

Overview

Since:

  • 0.0.3

Instance Method Summary collapse

Instance Method Details

#env_shebang(executable = ruby_basename, *args) ⇒ Object

Since:

  • 0.0.3



21
22
23
# File 'lib/simple-templater/helpers.rb', line 21

def env_shebang(executable = ruby_basename, *args)
  "#!/usr/bin/env #{executable} #{args.join(" ")}".chomp(" ")
end

#plain_shebang(executable = ruby_basename, *args) ⇒ Object

Since:

  • 0.0.3



17
18
19
# File 'lib/simple-templater/helpers.rb', line 17

def plain_shebang(executable = ruby_basename, *args)
  "#!#{executable} #{args.join(" ")}".chomp(" ")
end

#ruby_basenameObject

Since:

  • 0.0.3



29
30
31
# File 'lib/simple-templater/helpers.rb', line 29

def ruby_basename
  RbConfig::CONFIG["RUBY_INSTALL_NAME"]
end

#rubypathObject

Since:

  • 0.0.3



25
26
27
# File 'lib/simple-templater/helpers.rb', line 25

def rubypath
  File.join(RbConfig::CONFIG["bindir"], self.ruby_basename)
end

#shebang(executable = ruby_basename, *args) ⇒ Object

Since:

  • 0.0.3



9
10
11
12
13
14
15
# File 'lib/simple-templater/helpers.rb', line 9

def shebang(executable = ruby_basename, *args)
  if RUBY_PLATFORM.match(/darwin/)
    self.env_shebang(executable, args)
  else
    self.plain_shebang(executable, args)
  end
end