Exception: Suture::Error::InvalidPlan

Inherits:
StandardError
  • Object
show all
Defined in:
lib/suture/error/invalid_plan.rb

Constant Summary collapse

HEADER =
"Suture was unable to create your seam, because options passed to `Suture.create` were invalid."

Class Method Summary collapse

Class Method Details

.conflicting_options(conflicts) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/suture/error/invalid_plan.rb', line 29

def self.conflicting_options(conflicts)
  new <<-MSG.gsub(/^ {8}/,'')
    #{HEADER}

    Suture isn't sure how to best handle the combination of options passed:

      #{conflicts.map {|message|
          "* #{message}"
        }.join("\n  ")}
  MSG
end

.invalid_options(invalids) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/suture/error/invalid_plan.rb', line 17

def self.invalid_options(invalids)
  new <<-MSG.gsub(/^ {8}/,'')
    #{HEADER}

    The following options were invalid:

      #{invalids.map {|(name,rule)|
          "* #{name.inspect} - #{rule[:message]}"
        }.join("\n  ")}
  MSG
end

.missing_requirements(requirements) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/suture/error/invalid_plan.rb', line 5

def self.missing_requirements(requirements)
  new <<-MSG.gsub(/^ {8}/,'')
    #{HEADER}

    The following options are required:

      #{requirements.map {|(name,explanation)|
          "* #{name.inspect} - #{explanation}"
        }.join("\n  ")}
  MSG
end