null+****@clear*****
null+****@clear*****
Thu Jun 28 12:02:14 JST 2012
SHIMADA Koji 2012-06-03 11:35:25 +0900 (Sun, 03 Jun 2012) New Revision: 37192f3b0958f5c39506871e4bf99b75a4b0f07f https://github.com/logaling/logaling-command/commit/37192f3b0958f5c39506871e4bf99b75a4b0f07f Merged 7228757: Merge pull request #60 from logaling/refactor-structure Log: Take TermRenderer#extract_keyword_and_coloring apart Modified files: lib/logaling/command/renderers.rb Modified: lib/logaling/command/renderers.rb (+13 -4) =================================================================== --- lib/logaling/command/renderers.rb 2012-06-03 11:31:31 +0900 (5714fa5) +++ lib/logaling/command/renderers.rb 2012-06-03 11:35:25 +0900 (dc75f1d) @@ -47,10 +47,19 @@ module Logaling::Command private def extract_keyword_and_coloring(snipped_term, term) return term if snipped_term.empty? || @options["no-color"] - display_string = snipped_term.map do |word| - word.is_a?(Hash) ? word[:keyword].bright : word - end - display_string.join + build_term_string_from_snippets(snipped_term) + end + + def build_term_string_from_snippets(snippets) + snippets.map{|snippet| decorate_snippet(snippet) }.join + end + + def decorate_snippet(snippet) + keyword?(snippet) ? snippet[:keyword].bright : snippet + end + + def keyword?(snippet) + snippet.is_a?(Hash) end end -------------- next part -------------- An HTML attachment was scrubbed... 다운로드