Navigation Menu

Skip to content

Commit

Permalink
Make detailed method private
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jan 6, 2015
1 parent c39f9db commit 1fd676c
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions lib/droonga/engine_node.rb
Expand Up @@ -62,30 +62,13 @@ def forward(message, destination)
if not really_writable?
@buffer.add(message, destination)
elsif @buffer.empty?
@output(message, destination)
output(message, destination)
else
@buffer.add(message, destination)
@buffer.start_forward
end
end

def output(message, destination)
command = destination["type"]
receiver = destination["to"]
arguments = destination["arguments"]

override_message = {
"type" => command,
}
override_message["arguments"] = arguments if arguments
message = message.merge(override_message)
output_tag = "#{tag}.message"
log_info = "<#{receiver}>:<#{output_tag}>"
logger.trace("forward: start: #{log_info}")
@sender.send(output_tag, message)
logger.trace("forward: end")
end

def live?
@state.nil? or @state["live"]
end
Expand Down Expand Up @@ -159,6 +142,23 @@ def on_change
end

private
def output(message, destination)
command = destination["type"]
receiver = destination["to"]
arguments = destination["arguments"]

override_message = {
"type" => command,
}
override_message["arguments"] = arguments if arguments
message = message.merge(override_message)
output_tag = "#{tag}.message"
log_info = "<#{receiver}>:<#{output_tag}>"
logger.trace("forward: start: #{log_info}")
@sender.send(output_tag, message)
logger.trace("forward: end")
end

def log_tag
"[#{Process.ppid}] engine-node"
end
Expand Down

0 comments on commit 1fd676c

Please sign in to comment.