Class: Droonga::InputMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/droonga/input_message.rb

Instance Method Summary collapse

Constructor Details

#initialize(raw_message) ⇒ InputMessage

Returns a new instance of InputMessage.



20
21
22
# File 'lib/droonga/input_message.rb', line 20

def initialize(raw_message)
  @raw_message = raw_message
end

Instance Method Details

#adapted_messageObject



24
25
26
27
28
29
# File 'lib/droonga/input_message.rb', line 24

def adapted_message
  # TODO: We can create adapted message non-destructively.
  # If it is not performance issue, it is better that we don't
  # change message destructively. Consider about it later.
  @raw_message
end

#bodyObject



31
32
33
# File 'lib/droonga/input_message.rb', line 31

def body
  @raw_message["body"]
end

#body=(body) ⇒ Object



35
36
37
# File 'lib/droonga/input_message.rb', line 35

def body=(body)
  @raw_message["body"] = body
end

#typeObject



39
40
41
# File 'lib/droonga/input_message.rb', line 39

def type
  @raw_message["type"]
end

#type=(type) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/droonga/input_message.rb', line 43

def type=(type)
  original_type = @raw_message["type"]
  return if original_type == type
  @raw_message["originalTypes"] ||= []
  @raw_message["originalTypes"] << original_type
  @raw_message["type"] = type
end