Class: Rake::Funnel::Support::Finder
- Inherits:
-
Object
- Object
- Rake::Funnel::Support::Finder
- Includes:
- Enumerable
- Defined in:
- lib/rake/funnel/support/internal/finder.rb
Instance Method Summary collapse
- #all ⇒ Object
- #all_or_default ⇒ Object
- #each ⇒ Object
-
#initialize(search_pattern, task, message = nil) ⇒ Finder
constructor
A new instance of Finder.
- #single ⇒ Object
- #single_or_default ⇒ Object
Constructor Details
#initialize(search_pattern, task, message = nil) ⇒ Finder
Returns a new instance of Finder.
7 8 9 10 11 |
# File 'lib/rake/funnel/support/internal/finder.rb', line 7 def initialize(search_pattern, task, = nil) @search_pattern = search_pattern @task = task @message = end |
Instance Method Details
#all ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/rake/funnel/support/internal/finder.rb', line 34 def all if candidates.empty? raise Rake::Funnel::AmbiguousFileError.new(@message, @task.name, @search_pattern, candidates) end candidates end |
#all_or_default ⇒ Object
30 31 32 |
# File 'lib/rake/funnel/support/internal/finder.rb', line 30 def all_or_default candidates end |
#each ⇒ Object
13 14 15 16 |
# File 'lib/rake/funnel/support/internal/finder.rb', line 13 def each block_given? or return enum_for(__method__) all_or_default.each { |x| yield x } end |
#single ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/rake/funnel/support/internal/finder.rb', line 22 def single if first_sln.nil? raise Rake::Funnel::AmbiguousFileError.new(@message, @task.name, @search_pattern, candidates) end first_sln end |
#single_or_default ⇒ Object
18 19 20 |
# File 'lib/rake/funnel/support/internal/finder.rb', line 18 def single_or_default first_sln end |