Class: Sevgi::ValidationError
- Inherits:
-
Error
- Object
- Error
- Sevgi::ValidationError
- Defined in:
- lib/sevgi/standard/errors.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(context, args = []) ⇒ ValidationError
constructor
A new instance of ValidationError.
Constructor Details
#initialize(context, args = []) ⇒ ValidationError
Returns a new instance of ValidationError.
5 6 7 8 9 10 |
# File 'lib/sevgi/standard/errors.rb', line 5 def initialize(context, args = []) @context = context @args = Array(args) super() end |
Class Method Details
.call(context, args = []) ⇒ Object
12 |
# File 'lib/sevgi/standard/errors.rb', line 12 def self.call(context, args = []) = raise new(context, args) |
.variant(message) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/sevgi/standard/errors.rb', line 14 def self.variant() Class.new(self) do define_method(:message) do [@context, ] .tap do || << @args.map { "'#{it}'" }.join(", ") unless @args.empty? end .join(": ") end end end |