Class: Chef::Knife::StencilFile

Inherits:
Object
  • Object
show all
Includes:
StencilBase, JSON
Defined in:
lib/chef/knife/stencil_file.rb

Overview

Objects of this class represent the contents of your various stencil files

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from StencilBase

#build_plugin_klass, #explain, #invoked_as_stencil?, #locate_config_value, #normalize_path, #stencil_root

Constructor Details

#initialize(path, options = {}) ⇒ StencilFile

Returns a new instance of StencilFile.



32
33
34
35
36
37
38
39
40
# File 'lib/chef/knife/stencil_file.rb', line 32

def initialize(path, options={})
  deserialized = JSON.parse(IO.read(path), :symbolize_names => true)

  @path = normalize_path(path, stencil_root)
  @options = deserialized[:options] || []
  @inherits = deserialized[:inherits] || []
  @matches = deserialized[:matches] || nil

end

Instance Attribute Details

#inheritsObject

Returns the value of attribute inherits.



30
31
32
# File 'lib/chef/knife/stencil_file.rb', line 30

def inherits
  @inherits
end

#matchesObject

Returns the value of attribute matches.



30
31
32
# File 'lib/chef/knife/stencil_file.rb', line 30

def matches
  @matches
end

#optionsObject

Returns the value of attribute options.



30
31
32
# File 'lib/chef/knife/stencil_file.rb', line 30

def options
  @options
end

#pathObject

Returns the value of attribute path.



30
31
32
# File 'lib/chef/knife/stencil_file.rb', line 30

def path
  @path
end