私は私が除くディレクトリ名 - ルビー
folders = Dir.entries('features/tmp').select { |entry| File.directory? File.join('features/tmp', entry) and !(entry == '.' || entry == '..' || entry == '.git' || entry == 'step_definitions') }
を必要とするすべてのフォルダを取得し、以下を継承してきた。しかし、私はそれをクリーンアップするために、これをリファクタリングすると、私が今まで望んでいた場合は簡単に何かを追加するために探しています将来の任意のフォルダを除外ではなく、クエリ
を連鎖するだから私はこのが出ているが、
# Dir.entries('features/tmp').select { |entry| p entry }
# [".", "..", ".git", "idv4", "step_definitions"]
exclude = %w(. .. .git step_definitions)
Dir.entries('features/tmp').select { |entry| File.directory? File.join('features/tmp', exclude.include?(!entry))}
TypeError: no implicit conversion of false into String
from (pry):26:in `join'
次のエラーを取得する私はこのWROに近づいあり何か明白なものがないのですか?演算の順序に注意してください - 私は基本的に除外し、アレイにあなたが少し混ざった条件を持っていた
おかげ
多分、私は '!entry'のためにしています。あなたは 'String'を否定しています。 – lcguida