summaryrefslogtreecommitdiffstats
path: root/lib/puppet/rails/param.rb
diff options
context:
space:
mode:
authorshadoi <shadoi@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-15 20:26:40 +0000
committershadoi <shadoi@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-15 20:26:40 +0000
commit91991f186711251f20e1608815c49d360051c29a (patch)
tree0a0fab9db459b2d03f2dce89bcf15121d28a7b74 /lib/puppet/rails/param.rb
parent0b5600a6b49400551b01cec7aa3286d42e45d36c (diff)
downloadpuppet-91991f186711251f20e1608815c49d360051c29a.tar.gz
puppet-91991f186711251f20e1608815c49d360051c29a.tar.xz
puppet-91991f186711251f20e1608815c49d360051c29a.zip
Merge fact_names & fact_values, and param_names & param_values.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2191 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/rails/param.rb')
-rw-r--r--lib/puppet/rails/param.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/puppet/rails/param.rb b/lib/puppet/rails/param.rb
new file mode 100644
index 000000000..2e98bd258
--- /dev/null
+++ b/lib/puppet/rails/param.rb
@@ -0,0 +1,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.param.value.find(:all).collect { |v| v.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
+