lib/toaster/model/key_value_pair.rb in cloud-toaster-1.1.5 vs lib/toaster/model/key_value_pair.rb in cloud-toaster-1.1.6
- old
+ new
@@ -35,10 +35,22 @@
:value => value
)
}
return result
end
-
+
+ def self.flat_attributes_from_hash(hash, clazz=KeyValuePair)
+ result = []
+ return result if !hash
+ SystemState.get_flat_attributes(hash).each do |key,value|
+ result << clazz.new(
+ :key => key,
+ :value => value
+ )
+ end
+ return result
+ end
+
def to_s
return "#{self.class}(#{key}=#{value})"
end
def hash