Skip to content

Commit

Permalink
Deduplicate tree building: call build_*_tree with 1 or 0 args.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpovolny committed Sep 27, 2017
1 parent 2b43350 commit 9f9c89b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/controllers/application_controller/explorer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ def build_replaced_trees(replace_trees, valid_values)
def try_build_tree(tree_symbol)
method_name = "build_#{tree_symbol}_tree"
return unless respond_to?(method_name, true)
method(method_name).call(tree_symbol)
build_method = method(method_name)
# FIXME: This is temporary, we actually need to remove all the build_*_tree methods and
# use the Feature::build_tree instead.
build_method.arity == 1 ? build_method.call(tree_symbol) : build_method.call
end

# Historical tree item selected
Expand Down

0 comments on commit 9f9c89b

Please sign in to comment.