Sha256: ffe8e3521e6e9b08d6fc528f0ff8ff573d161e1627507e428e69a27ede058782

Contents?: true

Size: 655 Bytes

Versions: 49

Compression:

Stored size: 655 Bytes

Contents

# -*- encoding : utf-8 -*-
module Reactor
  module Plans
    class CommonChannel
      include Prepared

      ALLOWED_PARAMS = [:title]

      def initialize
        @params = {}
      end

      def set(key,value)
        @params[key.to_sym] = value
      end

      def migrate!
        raise "#{self.class.name} did not implement migrate!"
      end

      protected
      def prepare_params!(channel=nil)
        @params.keys.each{|k| error("unknown parameter: #{k}") unless ALLOWED_PARAMS.include? k}
      end

      def migrate_params!(channel)
        @params.each{|k,v|channel.send(:"#{k}=",v)}
        channel.save!
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 2 rubygems

Version Path
infopark_reactor_migrations-1.8.4 lib/reactor/plans/common_channel.rb
infopark_reactor_migrations-1.8.3 lib/reactor/plans/common_channel.rb
infopark_reactor_migrations-1.8.2 lib/reactor/plans/common_channel.rb
infopark_reactor_migrations-1.8.1 lib/reactor/plans/common_channel.rb
infopark_reactor_migrations-1.8.0 lib/reactor/plans/common_channel.rb
infopark_reactor_migrations-1.7.2 lib/reactor/plans/common_channel.rb
infopark_reactor_migrations-1.7.1 lib/reactor/plans/common_channel.rb
infopark_reactor_migrations-1.7.0 lib/reactor/plans/common_channel.rb
infopark_reactor_migrations-1.6.3 lib/reactor/plans/common_channel.rb