Class: Chef::Attribute::Validator::AttributeSet

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/chef-attribute-validator/attribute_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a_node, a_path) ⇒ AttributeSet

Returns a new instance of AttributeSet.



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/chef-attribute-validator/attribute_set.rb', line 19

def initialize(a_node, a_path)
  @guts = {}
  @path = a_path
  @node = a_node

  expander = Chef::Attribute::Validator::WildcardExpander.choose(path, node)

  # TODO: less dumb thing would be to have wildcard expander just be an enumerator
  # and then call it on each access
  expander.expand_all.each do | slashpath |
    guts[slashpath] = expander.fetch_val_by_slashpath(slashpath)
  end
end

Instance Attribute Details

#gutsObject

Returns the value of attribute guts.



11
12
13
# File 'lib/chef-attribute-validator/attribute_set.rb', line 11

def guts
  @guts
end

#nodeObject

Returns the value of attribute node.



13
14
15
# File 'lib/chef-attribute-validator/attribute_set.rb', line 13

def node
  @node
end

#pathObject

Returns the value of attribute path.



12
13
14
# File 'lib/chef-attribute-validator/attribute_set.rb', line 12

def path
  @path
end