module WinRM::FS::Scripts
PS1 scripts
Public Class Methods
Source
# File lib/winrm-fs/scripts/scripts.rb, line 25 def self.render(template, context) # rubocop:enable Metrics/MethodLength template_path = File.expand_path( "#{File.dirname(__FILE__)}/#{template}.ps1.erb" ) template = File.read(template_path) case context when Hash b = binding locals = context.collect { |k, _| "#{k} = context[#{k.inspect}]; " } b.eval(locals.join) when Binding b = context when NilClass b = binding else raise ArgumentError end b.eval(Erubi::Engine.new(template).src) end
rubocop:disable Metrics/MethodLength