Module: Chef::Node::Mixin::MashyArray

Included in:
AttrArray
Defined in:
lib/chef/node/mixin/mashy_array.rb

Overview

missing methods for Arrays similar to Chef::Mash methods that call convert_value correctly.

Instance Method Summary collapse

Instance Method Details

#<<(obj) ⇒ Object


24
25
26
# File 'lib/chef/node/mixin/mashy_array.rb', line 24

def <<(obj)
  super(convert_value(obj))
end

#[]=(*keys, value) ⇒ Object


28
29
30
# File 'lib/chef/node/mixin/mashy_array.rb', line 28

def []=(*keys, value)
  super(*keys, convert_value(value))
end

#collect!(&block) ⇒ Object


47
48
49
50
# File 'lib/chef/node/mixin/mashy_array.rb', line 47

def collect!(&block)
  super
  map! { |x| convert_value(x) }
end

#fill(*args, &block) ⇒ Object


57
58
59
60
# File 'lib/chef/node/mixin/mashy_array.rb', line 57

def fill(*args, &block)
  super
  map! { |x| convert_value(x) }
end

#insert(index, *objs) ⇒ Object


42
43
44
45
# File 'lib/chef/node/mixin/mashy_array.rb', line 42

def insert(index, *objs)
  objs = objs.map { |obj| convert_value(obj) }
  super(index, *objs)
end

#map!(&block) ⇒ Object


52
53
54
55
# File 'lib/chef/node/mixin/mashy_array.rb', line 52

def map!(&block)
  super
  super { |x| convert_value(x) }
end

#push(*objs) ⇒ Object


32
33
34
35
# File 'lib/chef/node/mixin/mashy_array.rb', line 32

def push(*objs)
  objs = objs.map { |obj| convert_value(obj) }
  super(*objs)
end

#replace(obj) ⇒ Object


62
63
64
# File 'lib/chef/node/mixin/mashy_array.rb', line 62

def replace(obj)
  super(convert_value(obj))
end

#unshift(*objs) ⇒ Object


37
38
39
40
# File 'lib/chef/node/mixin/mashy_array.rb', line 37

def unshift(*objs)
  objs = objs.map { |obj| convert_value(obj) }
  super(*objs)
end