Class: Droonga::HandlerMessage
- Inherits:
-
Object
- Object
- Droonga::HandlerMessage
- Defined in:
- lib/droonga/handler_message.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #body ⇒ Object
- #descendants ⇒ Object
- #id ⇒ Object
-
#initialize(raw) ⇒ HandlerMessage
constructor
A new instance of HandlerMessage.
- #request ⇒ Object
- #step ⇒ Object
- #task ⇒ Object
- #validate ⇒ Object
Constructor Details
#initialize(raw) ⇒ HandlerMessage
Returns a new instance of HandlerMessage.
19 20 21 |
# File 'lib/droonga/handler_message.rb', line 19 def initialize(raw) @raw = raw end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
18 19 20 |
# File 'lib/droonga/handler_message.rb', line 18 def raw @raw end |
Instance Method Details
#[](name) ⇒ Object
33 34 35 |
# File 'lib/droonga/handler_message.rb', line 33 def [](name) @raw[name] end |
#body ⇒ Object
37 38 39 |
# File 'lib/droonga/handler_message.rb', line 37 def body @body ||= self["body"] end |
#descendants ⇒ Object
57 58 59 |
# File 'lib/droonga/handler_message.rb', line 57 def descendants @descendants ||= body["descendants"] end |
#id ⇒ Object
53 54 55 |
# File 'lib/droonga/handler_message.rb', line 53 def id @id ||= body["id"] end |
#request ⇒ Object
49 50 51 |
# File 'lib/droonga/handler_message.rb', line 49 def request @request ||= step["body"] end |
#step ⇒ Object
45 46 47 |
# File 'lib/droonga/handler_message.rb', line 45 def step @step ||= task["step"] end |
#task ⇒ Object
41 42 43 |
# File 'lib/droonga/handler_message.rb', line 41 def task @task ||= body["task"] end |
#validate ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/droonga/handler_message.rb', line 23 def validate unless task.is_a?(Hash) raise "<task> value isn't object: <#{@raw.inspect}>" end unless step.is_a?(Hash) raise "<task/step> value isn't object: <#{@raw.inspect}>" end end |