Navigation Menu

Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
We can know about the formatter is what formatter in the small methods.
  • Loading branch information
kou committed Apr 8, 2014
1 parent cc73eb6 commit 7949ddb
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions lib/droonga/searcher.rb
Expand Up @@ -622,16 +622,12 @@ def format_count
end

def format_attributes
attributes_formatter = nil
if @request.complex_output?
attributes_formatter = ComplexAttributesFormatter.new
formatter = ComplexAttributesFormatter.new
else
attributes_formatter = SimpleAttributesFormatter.new
formatter = SimpleAttributesFormatter.new
end
attributes_formatter.format_attributes(
output_target_attributes,
@result.records
)
formatter.format_attributes(output_target_attributes, @result.records)
end

def output_target_attributes
Expand All @@ -640,13 +636,12 @@ def output_target_attributes
end

def format_records
records_formatter = nil
if @request.complex_output?
records_formatter = ComplexRecordsFormatter.new
formatter = ComplexRecordsFormatter.new
else
records_formatter = SimpleRecordsFormatter.new
formatter = SimpleRecordsFormatter.new
end
records_formatter.format_records(output_target_attributes, @result.records, output_limit, output_offset)
formatter.format_records(output_target_attributes, @result.records, output_limit, output_offset)
end

def normalize_target_attributes(attributes, domain = @result.records)
Expand Down

0 comments on commit 7949ddb

Please sign in to comment.