Sha256: d97568436e6dd8637f225f90778093ad128f32246d08e4b6cadf7688699985a2
Contents?: true
Size: 722 Bytes
Versions: 3
Compression:
Stored size: 722 Bytes
Contents
module WorkflowKit class Parameter < ActiveRecord::Base attr_accessible :key, :value belongs_to :parameterable, polymorphic: true def key return super.to_sym unless super.kind_of? Symbol return super end def value v = super v = v.to_i if ( not v.to_i == nil ) and ( v.to_i.to_s == v ) v = true if v == "true" v = false if v == "false" return v end def to_hash return { key => value } end def self.to_hash( parameters ) parameter_hashes = parameters.collect do |parameter| parameter.to_hash end merged_hash = parameter_hashes.inject { |all, h| all.merge( h ) } return merged_hash end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
workflow_kit-0.0.3.alpha | app/models/workflow_kit/parameter.rb |
workflow_kit-0.0.2.alpha | app/models/workflow_kit/parameter.rb |
workflow_kit-0.0.1.apha | app/models/workflow_kit/parameter.rb |