Sha256: f56ed46bba4e493939018dafcb711eb3363d18a87511cda6e7fd6a4782661dcf

Contents?: true

Size: 649 Bytes

Versions: 8

Compression:

Stored size: 649 Bytes

Contents

module Reactor
  module Plans
    class CommonChannel
      include Prepared

      ALLOWED_PARAMS = [:title].freeze

      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

8 entries across 8 versions & 1 rubygems

Version Path
infopark_reactor-1.29.1 lib/reactor/plans/common_channel.rb
infopark_reactor-1.29.0 lib/reactor/plans/common_channel.rb
infopark_reactor-1.28.0 lib/reactor/plans/common_channel.rb
infopark_reactor-1.27.0.rc10 lib/reactor/plans/common_channel.rb
infopark_reactor-1.27.0.rc9 lib/reactor/plans/common_channel.rb
infopark_reactor-1.27.0.rc8 lib/reactor/plans/common_channel.rb
infopark_reactor-1.27.0.rc7 lib/reactor/plans/common_channel.rb
infopark_reactor-1.27.0.rc4 lib/reactor/plans/common_channel.rb