Class: RedisRing::Client::ShardMetaData

Inherits:
Object
  • Object
show all
Defined in:
lib/redis_ring/client/ring_meta_data.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, port, status) ⇒ ShardMetaData

Returns a new instance of ShardMetaData.



72
73
74
75
76
77
# File 'lib/redis_ring/client/ring_meta_data.rb', line 72

def initialize(host, port, status)
  @host = host
  @port = port
  @status = status
  @sym = :"Redis<#{host}:#{port}>"
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



70
71
72
# File 'lib/redis_ring/client/ring_meta_data.rb', line 70

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



70
71
72
# File 'lib/redis_ring/client/ring_meta_data.rb', line 70

def port
  @port
end

#statusObject (readonly)

Returns the value of attribute status.



70
71
72
# File 'lib/redis_ring/client/ring_meta_data.rb', line 70

def status
  @status
end

Class Method Details

.from_json(hash) ⇒ Object



79
80
81
# File 'lib/redis_ring/client/ring_meta_data.rb', line 79

def self.from_json(hash)
  new(hash['host'], hash['port'].to_i, hash['status'].to_sym)
end

Instance Method Details

#to_symObject



83
84
85
# File 'lib/redis_ring/client/ring_meta_data.rb', line 83

def to_sym
  @sym
end