Exception: 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
13 |
# File 'lib/sevgi/standard/errors.rb', line 13 def call(context, args = []) = raise(new(context, args)) |
.variant(message) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/sevgi/standard/errors.rb', line 15 def variant() Class.new(self) do define_method(:message) do [ @context, ].tap do || << @args.map { "'#{_1}'" }.join(", ") unless @args.empty? end.join(": ") end end end |