Sha256: 0dd435a79a0244d3790d2f46163a94d6b71a4afc5f4679efc6a41b5aa47fa42a

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

require_relative 'entity'

module Services
  # This is a service member usually something that
  # would be sitting behind some VIP
  class Member < Services::Entity
    attr_accessor :ip, :port, :proto, :service, :weight
    def initialize(name, args = {})
      @ip = args[:ip] || ''
      @proto = args[:proto] || 'http'
      @port  = args[:port]  || 80
      @weight = args[:weight] || 20
      @service = args[:service]
      @path = "#{service}/members/#{name}"
      super
    end

    private

    def validate
      fail ARgumentError,
           "#{self.class} requires name and service argument" unless name && @service
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jn_services-1.0.8 lib/services/member.rb