class Bashly::Script::Wrapper
Attributes
command[R]
function_name[R]
Public Class Methods
new(command, function_name = nil)
click to toggle source
# File lib/bashly/script/wrapper.rb, line 8 def initialize(command, function_name = nil) @command = command @function_name = function_name end
Public Instance Methods
code(tab_indent: false)
click to toggle source
# File lib/bashly/script/wrapper.rb, line 13 def code(tab_indent: false) tab_indent ? base_code.expand_tabs : base_code end
Private Instance Methods
base_code()
click to toggle source
# File lib/bashly/script/wrapper.rb, line 19 def base_code result = if function_name [header, render('wrapper')] else [header, body] end result.join("\n").lint end
body()
click to toggle source
# File lib/bashly/script/wrapper.rb, line 47 def body @body ||= command.render 'master_script' end
custom_header_path()
click to toggle source
# File lib/bashly/script/wrapper.rb, line 51 def custom_header_path @custom_header_path ||= "#{Settings.source_dir}/header.#{Settings.partials_extension}" end
default_header()
click to toggle source
# File lib/bashly/script/wrapper.rb, line 41 def default_header result = render 'header' result += render('bash3_bouncer') unless function_name result end
header()
click to toggle source
# File lib/bashly/script/wrapper.rb, line 29 def header @header ||= header! end
header!()
click to toggle source
# File lib/bashly/script/wrapper.rb, line 33 def header! if File.exist? custom_header_path File.read custom_header_path else default_header end end