Sha256: f9234a3aef8457aeac9a40e8df3e1aa3421f8c30aedc2975126f99cfeb84d95c

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

module CapistranoSentinel
  class Configuration
    SETTINGS = [:host, :port, :path, :secure, :auto_pong, :read_buffer_size,:reconnect, :retry_time, :wait_execution]

    SETTINGS.each do |setting|
      attr_reader setting
      attr_accessor setting
    end

    def initialize
      @secure  = false
      @host    = '0.0.0.0'
      @port    = 1234
      @path    = '/ws'
      @auto_pong = true
      @read_buffer_size = 2048
      @reconnect = false
      @retry_time = 0
      @wait_execution = true
    end

    def update(settings_hash)
      settings_hash.each do |setting, value|
        unless SETTINGS.include? setting.to_sym
          raise ArgumentError, "invalid setting: #{setting}"
        end

        self.public_send "#{setting}=", value
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano_sentinel-0.0.12 lib/capistrano_sentinel/classes/configuration.rb