class Garcon::Resource::Attribute

Public Class Methods

from_hash(hash) click to toggle source
# File lib/garcon/chef/resource/attribute.rb, line 45
def self.from_hash(hash)
  mash = Attribute.new(hash)
  mash.default = hash.default
  mash
end

Public Instance Methods

method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/garcon/chef/resource/attribute.rb, line 28
def method_missing(method, *args, &block)
  if (match = method.to_s.match(/(.*)=$/)) && args.size == 1
    self[match[1]] = args.first
  elsif (match = method.to_s.match(/(.*)\?$/)) && args.size == 0
    key?(match[1])
  elsif key?(method)
    self[method]
  else
    super
  end
end
validate(map) click to toggle source
Calls superclass method
# File lib/garcon/chef/resource/attribute.rb, line 40
def validate(map)
  data = super(symbolize_keys, map)
  data.each { |k,v| self[k.to_sym] = v }
end