Skip to content

Commit

Permalink
refactor again.
Browse files Browse the repository at this point in the history
  • Loading branch information
masa21kik committed Jan 2, 2014
1 parent 99de83a commit 582c963
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/json_cli/unwind.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ def self.unwind_array(io, unwind_key, opt = {})
end

def self.unwind_hash(io, unwind_key, opt = {})
opt = {
out: STDOUT,
flatten: false,
key_label: 'key',
value_label: 'value',
}.merge(opt)
opt[:out] ||= STDOUT
opt[:key_label] ||= 'key'
opt[:value_label] ||= 'value'
io.each_line do |l|
j = MultiJson.load(l.chomp)
if j.key?(unwind_key) && j[unwind_key].is_a?(Hash)
Expand Down

0 comments on commit 582c963

Please sign in to comment.