Created
June 23, 2011 05:32
-
-
Save shunirr/1041964 to your computer and use it in GitHub Desktop.
typablemap 変更案
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 実装見てない and 記憶だけで書く | |
# 現状 | |
# status | |
@typablemap.push [status_oid, status_object] | |
# comment | |
@typablemap.push [comment_oid, parent_status_object] | |
# command_manager | |
oid, object = @typablemap[tid] | |
if oid != object.id | |
# comment | |
object.comments.each do |comment| | |
if oid == comment.id | |
target = comment | |
break | |
end | |
end | |
else | |
target = object | |
end | |
# ... do something | |
# 変更案 | |
# @typablemap に push する object は parent への参照がある | |
# see feed.rb | |
# status | |
@typablemap.push [status_oid, status_object] # そのまま | |
# comment | |
@typablemap.push [comment_oid, comment_object] # コメントへの object をいれる | |
# command_manager | |
oid, object = @typablemap[tid] | |
if object.class == Comment.class | |
# comment の場合は parent に付ける | |
comment_process object.parent.id, message | |
end | |
# like のときは気にしなくて良くて oid に直接 like する | |
# like 元発言を表示するときも、 Status か Comment かを意識することなく、 object.message を見れば良い |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment