Sha256: c8a76b13c1ca5108cbf499fcc64adba90963f7427a69492ccd1ff583b8ee2aff

Contents?: true

Size: 1.36 KB

Versions: 36

Compression:

Stored size: 1.36 KB

Contents

module PoolParty
  module DependencyResolutions
    module Puppet
      
      def pretty_print_resources(pre=" ")
        returning Array.new do |out|
          resources.each do |name, res|
            out << "#{pre}#{name}"
            out << "#{pre*2}#{res.map {|a| a.name}}"
            res.each do |r|
              out << "#{pre*2}#{r.pretty_print_resources(pre*2)}"
            end
          end
        end.join("\n")
      end
      
      # Generic to_s
      # Most Resources won't need to extend this
      def to_string(pre="")
        opts = get_modified_options
        returning Array.new do |output|
          unless cancelled?
            output << @prestring || ""
          
            if resources && !resources.empty?
              @cp = classpackage_with_self(self)
              output << @cp.to_string
              output << "include #{@cp.name.sanitize}"
            end
            
            unless virtual_resource?
              output << "#{pre}#{class_type_name.downcase} {"
              output << "#{pre}\"#{self.key}\":"
              output << opts.flush_out("#{pre*2}").join(",\n")
              output << "#{pre}}"            
            end
          
            output << @poststring || ""
          end
        end.join("\n")
      end
      
      def to_s
        "#{class_type_name.capitalize}['#{key}']"
      end
      
    end
  end
end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
auser-poolparty-0.2.15 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.16 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.20 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.21 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.22 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.23 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.24 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.25 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.26 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.35 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.36 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.37 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.38 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.39 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.40 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.41 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.42 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.44 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.45 lib/poolparty/dependency_resolutions/puppet.rb
auser-poolparty-0.2.46 lib/poolparty/dependency_resolutions/puppet.rb