Sha256: b2c5579fe7c2fe2acb31ba8b1cb730ada536216601febfbfda4140a8815e6a9b

Contents?: true

Size: 960 Bytes

Versions: 7

Compression:

Stored size: 960 Bytes

Contents

class Fluentd
  module Setting
    class OutMongo
      include Common

      KEYS = [
        :match,
        :host, :port, :database, :collection, :capped, :capped_size, :capped_max, :user, :password, :tag_mapped,
        :buffer_type, :buffer_queue_limit, :buffer_chunk_limit, :flush_interval,  :retry_wait, :retry_limit, :max_retry_wait, :num_threads,
      ].freeze

      attr_accessor(*KEYS)

      flags :capped, :tag_mapped

      validates :match, presence: true
      validates :host, presence: true
      validates :port, presence: true
      validates :database, presence: true
      validate :validate_capped
      validate :validate_collection

      def validate_capped
        return true if capped.blank?
        errors.add(:capped_size, :blank) if capped_size.blank?
      end

      def validate_collection
        if tag_mapped.blank? && collection.blank?
          errors.add(:collection, :blank) 
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fluentd-ui-0.3.0 app/models/fluentd/setting/out_mongo.rb
fluentd-ui-0.2.0 app/models/fluentd/setting/out_mongo.rb
fluentd-ui-0.1.4 app/models/fluentd/setting/out_mongo.rb
fluentd-ui-0.1.3 app/models/fluentd/setting/out_mongo.rb
fluentd-ui-0.1.2 app/models/fluentd/setting/out_mongo.rb
fluentd-ui-0.1.1 app/models/fluentd/setting/out_mongo.rb
fluentd-ui-0.1.0 app/models/fluentd/setting/out_mongo.rb