Sha256: 60e3f59231118ecf50238d12a26b1dd9ee722a82ed2fac5fcfd3a04b7c192ced

Contents?: true

Size: 761 Bytes

Versions: 2

Compression:

Stored size: 761 Bytes

Contents

require 'puppet/util/rails/collection_merger'
require 'puppet/rails/param_value'

class Puppet::Rails::ParamName < ActiveRecord::Base
    include Puppet::Util::CollectionMerger
    has_many :param_values, :dependent => :destroy 

    def to_resourceparam(resource, source)
        hash = {}
        hash[:name] = self.name.to_sym
        hash[:source] = source
        hash[:value] = resource.param_values.find(:all, :conditions => [ "param_name_id = ?", self]).collect { |v| v.value }
        if hash[:value].length == 1
            hash[:value] = hash[:value].shift
        elsif hash[:value].empty?
            hash[:value] = nil
        end
        Puppet::Parser::Resource::Param.new hash
    end
end

# $Id: param_name.rb 2706 2007-07-18 19:47:09Z luke $

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-0.23.1 lib/puppet/rails/param_name.rb
puppet-0.23.2 lib/puppet/rails/param_name.rb