Sha256: 66bdb03249b332622e28f9de51a0e97f1085179ba7c96136cdb1c64dc5af540b

Contents?: true

Size: 821 Bytes

Versions: 11

Compression:

Stored size: 821 Bytes

Contents

module Rake::Funnel
  class AmbiguousFileError < StandardError
    attr_reader :task_name, :search_pattern, :candidates, :description

    def initialize(message, task_name, search_pattern, candidates)
      description = "Could not run task '#{task_name}'. #{message}"
      super(description)

      @description = description
      @task_name = task_name
      @search_pattern = search_pattern
      @candidates = candidates
    end

    def to_s
      msg = []
      (msg << description) if description
      (msg << "Search pattern used: #{@search_pattern}") if @search_pattern
      unless (@candidates || []).empty?
        msg << 'Candidates:'
        msg << @candidates.map { |c| "  - #{c}" }
      end

      msg = [super.to_s] if msg.empty?

      msg.join("\n")
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rake-funnel-0.3.2.pre lib/rake/funnel/ambiguous_file_error.rb
rake-funnel-0.3.1.pre lib/rake/funnel/ambiguous_file_error.rb
rake-funnel-0.3.0.pre lib/rake/funnel/ambiguous_file_error.rb
rake-funnel-0.2.0.pre lib/rake/funnel/ambiguous_file_error.rb
rake-funnel-0.1.0.pre lib/rake/funnel/ambiguous_file_error.rb
rake-funnel-0.0.6.pre lib/rake/funnel/ambiguous_file_error.rb
rake-funnel-0.0.5.pre lib/rake/funnel/ambiguous_file_error.rb
rake-funnel-0.0.4.pre lib/rake/funnel/ambiguous_file_error.rb
rake-funnel-0.0.3.pre lib/rake/funnel/ambiguous_file_error.rb
rake-funnel-0.0.2.pre lib/rake/funnel/ambiguous_file_error.rb
rake-funnel-0.0.1.pre lib/rake/funnel/ambiguous_file_error.rb