summaryrefslogtreecommitdiffstats
path: root/lib/puppet/rails/param.rb
blob: 108bc48d4f9a77ed5b51f4f680191e6fc8927290 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'puppet/util/rails/collection_merger'

class Puppet::Rails::Param < ActiveRecord::Base
    include Puppet::Util::CollectionMerger
    belongs_to :resource

    def to_resourceparam(source)
        hash = {}
        hash[:name] = self.name.to_sym
        hash[:source] = source
        hash[:value] = self.value
        if hash[:value].length == 1
            hash[:value] = hash[:value].shift
        end
        if hash[:value].empty?
            hash[:value] = nil
        end
        Puppet::Parser::Resource::Param.new hash
    end
end