Module: Chef::Mixin::Template

Included in:
Provider::Template::Content
Defined in:
lib/chef/mixin/template.rb

Defined Under Namespace

Modules: ChefContext Classes: TemplateContext, TemplateError

Class Method Summary collapse

Class Method Details

.binread(file) ⇒ Object

A compatibility wrapper around IO.binread so it works on Ruby 1.8.7. – Used in the TemplateContext class, but that method namespace is shared with user code, so we want to avoid adding methods there when possible.



30
31
32
33
34
35
36
# File 'lib/chef/mixin/template.rb', line 30

def self.binread(file)
  if IO.respond_to?(:binread)
    IO.binread(file)
  else
    File.open(file, "rb") {|f| f.read }
  end
end