Class: Jubatus::Graph::Query

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/jubatus/graph/types.rb

Constant Summary collapse

TYPE =
TTuple.new(TString.new, TString.new)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common

check_type, check_types

Constructor Details

#initialize(from_id, to_id) ⇒ Query

Returns a new instance of Query.


50
51
52
53
# File 'lib/jubatus/graph/types.rb', line 50

def initialize(from_id, to_id)
  @from_id = from_id
  @to_id = to_id
end

Instance Attribute Details

#from_idObject (readonly)

Returns the value of attribute from_id


74
75
76
# File 'lib/jubatus/graph/types.rb', line 74

def from_id
  @from_id
end

#to_idObject (readonly)

Returns the value of attribute to_id


74
75
76
# File 'lib/jubatus/graph/types.rb', line 74

def to_id
  @to_id
end

Class Method Details

.from_msgpack(m) ⇒ Object


60
61
62
63
# File 'lib/jubatus/graph/types.rb', line 60

def Query.from_msgpack(m)
  val = TYPE.from_msgpack(m)
  Query.new(*val)
end

Instance Method Details

#to_msgpack(out = '') ⇒ Object


55
56
57
58
# File 'lib/jubatus/graph/types.rb', line 55

def to_msgpack(out = '')
  t = [@from_id, @to_id]
  return TYPE.to_msgpack(t)
end

#to_sObject


65
66
67
68
69
70
71
72
# File 'lib/jubatus/graph/types.rb', line 65

def to_s
  gen = Jubatus::Common::MessageStringGenerator.new
  gen.open("query")
  gen.add("from_id", @from_id)
  gen.add("to_id", @to_id)
  gen.close()
  return gen.to_s
end