lib/poolparty/dependency_resolver/chef_resolver.rb
def to_option_string(obj)
      case obj
      when PoolParty::Resources::Resource
        "resources(:#{handle_chef_types(obj.class.to_s.top_level_class.downcase.to_sym)} => \"#{obj.name}\")"
      when Fixnum
        "#{obj.to_i}"
      when String
        "\"#{obj}\""
      when Array
        # If we are sending a notifies with a second argument
        if obj[1] && [:immediately, :delayed].include?(obj[1])
          "#{to_option_string(obj[0])}, :#{obj[1]}"
        else
          "[ #{obj.map {|e| to_option_string(e) }.reject {|a| a.nil? || a.empty? }.join(", ")} ]"
        end        
      when nil
        nil
      when Symbol
        ":#{obj}"
      when Hash
        "#{obj.map {|k,v| ":#{k} => #{to_option_string(v)}" unless v == obj }.compact.join(",\n")}"
      else
        "#{obj}"
      end
    end
# Resolve the value of the resource hash into a meaningful chef
# value. Resources are turned into resource strings here
#
Resolve the value of the resource hash into a meaningful chef
value. Resources are turned into resource strings here
Resolve the value of the resource hash into a meaningful chef value . Resources are turned into resource strings here
def to_option_string(obj)
      case obj
      when PoolParty::Resources::Resource
        "resources(:#{handle_chef_types(obj.class.to_s.top_level_class.downcase.to_sym)} => \"#{obj.name}\")"
      when Fixnum
        "#{obj.to_i}"
      when String
        "\"#{obj}\""
      when Array
        if obj[1] && [:immediately, :delayed].include?(obj[1])
          "#{to_option_string(obj[0])}, :#{obj[1]}"
        else
          "[ #{obj.map {|e| to_option_string(e) }.reject {|a| a.nil? || a.empty? }.join(", ")} ]"
        end        
      when nil
        nil
      when Symbol
        ":#{obj}"
      when Hash
        "#{obj.map {|k,v| ":#{k} => #{to_option_string(v)}" unless v == obj }.compact.join(",\n")}"
      else
        "#{obj}"
      end
    end
def to_option_string ( obj ) case obj when PoolParty :: Resources :: Resource "resources(:#{handle_chef_types(obj.class.to_s.top_level_class.downcase.to_sym)} => \"#{obj.name}\")" when Fixnum "#{obj.to_i}" when String "\"#{obj}\"" when Array if obj [ 1 ] && [ :immediately , :delayed ] . include? ( obj [ 1 ] ) "#{to_option_string(obj[0])}, :#{obj[1]}" else "[ #{obj.map {|e| to_option_string(e) }.reject {|a| a.nil? || a.empty? }.join(", ")} ]" end when nil nil when Symbol ":#{obj}" when Hash "#{obj.map {|k,v| ":#{k} => #{to_option_string(v)}" unless v == obj }.compact.join(",\n")}" else "#{obj}" end end
Resolve the value of the resource hash into a meaningful chef
value.
Resolve the value of the resource hash into a meaningful chef value .
# If we are sending a notifies with a second argument
obj