Skip to content

Commit

Permalink
Merge pull request #9 from amrrbakry/enhancement/sort-list-alphabetic…
Browse files Browse the repository at this point in the history
…ally

Sort list and methods alphabetically
  • Loading branch information
akabiru authored Sep 24, 2018
2 parents 1d88190 + c1c9349 commit 1362a0f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/fakerbot/renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ def call
attr_reader :crayon, :hash, :options, :output, :pager, :screen, :tree

def build_tree
hash.reduce({}) do |h, (faker, methods)|
h.merge! node(faker, methods)
data_tree = hash.reduce({}) do |h, (faker, methods)|
h.merge! node(faker, methods&.sort)
end
data_tree.sort_by(&:to_s).to_h
end

def node(const, methods)
Expand Down

0 comments on commit 1362a0f

Please sign in to comment.