Skip to content

Commit

Permalink
Handle some of the value maybe nil
Browse files Browse the repository at this point in the history
Using reject because Ruby 2.3 has no Hash#compact
  • Loading branch information
JuanitoFatas committed May 23, 2019
1 parent 06ea2f0 commit fa91926
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/gel/command/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module MarkdownFormatter
def self.format(data)
data.each do |section, value_hash|
puts "\n## #{section}"
value_hash.each do |name, value|
value_hash.reject { |_, v| v.nil? }.each do |name, value|

if value.is_a?(RelevantFile)
print_codeblock(name, value)
Expand Down Expand Up @@ -71,7 +71,7 @@ def to_s
"Gemfile",
"Gemfile.lock",
"*.gemspec",
].compact.map { |path| [path, RelevantFile.new(path)] }.to_h
].map { |path| [path, RelevantFile.new(path)] }.to_h
private_constant :RELEVANT_FILES

def env_fetch(key, fallback = nil)
Expand Down

0 comments on commit fa91926

Please sign in to comment.