Class: ThriftModel

Inherits:
Object
  • Object
show all
Defined in:
lib/reminder-client/thrift_model.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :ip => nil,
  :port => nil,
  :serviceType => nil,
  :serviceName => nil,
  :workerSize => nil,
  :selectorSize => nil    
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ThriftModel

Returns a new instance of ThriftModel.



13
14
15
16
17
18
19
20
21
22
# File 'lib/reminder-client/thrift_model.rb', line 13

def initialize(options)
  raise "initialize ThriftModel error, options can not be nil." if options == nil 
  #@options = DEFAULT_OPTIONS.merge(options)
  @ip = options[:ip]
  @port = options[:port]
  @serviceType = options[:serviceType]
  @serviceName = options[:serviceName]
  @workerSize = options[:workerSize]
  @selectorSize =  options[:selectorSize]
end

Instance Attribute Details

#ipObject

Returns the value of attribute ip.



2
3
4
# File 'lib/reminder-client/thrift_model.rb', line 2

def ip
  @ip
end

#portObject

Returns the value of attribute port.



2
3
4
# File 'lib/reminder-client/thrift_model.rb', line 2

def port
  @port
end

#selectorSizeObject

Returns the value of attribute selectorSize.



2
3
4
# File 'lib/reminder-client/thrift_model.rb', line 2

def selectorSize
  @selectorSize
end

#serviceNameObject

Returns the value of attribute serviceName.



2
3
4
# File 'lib/reminder-client/thrift_model.rb', line 2

def serviceName
  @serviceName
end

#serviceTypeObject

Returns the value of attribute serviceType.



2
3
4
# File 'lib/reminder-client/thrift_model.rb', line 2

def serviceType
  @serviceType
end

#workerSizeObject

Returns the value of attribute workerSize.



2
3
4
# File 'lib/reminder-client/thrift_model.rb', line 2

def workerSize
  @workerSize
end

Instance Method Details

#to_hashObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/reminder-client/thrift_model.rb', line 24

def to_hash
  {
  :ip => @ip,
  :port => @port,
  :serviceType => @serviceType,
  :serviceName => @serviceName,
  :workerSize => @workerSize,
  :selectorSize => @selectorSize
  }
end