Exception: Omnibus::MissingRequiredAttribute

Inherits:
Error
  • Object
show all
Defined in:
lib/omnibus/exceptions.rb

Instance Method Summary collapse

Constructor Details

#initialize(instance, name, sample = '<VALUE>') ⇒ MissingRequiredAttribute


49
50
51
52
# File 'lib/omnibus/exceptions.rb', line 49

def initialize(instance, name, sample = '<VALUE>')
  @instance, @name, @sample = instance, name, sample
  @class = instance.class.name.split('::').last
end

Instance Method Details

#to_sObject


54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/omnibus/exceptions.rb', line 54

def to_s
  "Missing required attribute `\#{@name}' for \#{@class}. You must\nspecify a value for `\#{@name}' in your DSL file:\n\n\#{@name} \#{@sample.inspect}\n\nOr set the value on the object:\n\n\#{@class.downcase}.\#{@name}(\#{@sample.inspect})\n"
end