Class: ValRequired::RequiredHelper

Inherits:
Struct
  • Object
show all
Defined in:
lib/val_required.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



24
25
26
27
28
29
# File 'lib/val_required.rb', line 24

def method_missing method, *args
  (res = obj.send(method, *args)).required!

rescue BlankError
  raise BlankError, "#{method} returned #{res.inspect}"
end

Instance Attribute Details

#objObject

Returns the value of attribute obj

Returns:

  • (Object)

    the current value of obj



23
24
25
# File 'lib/val_required.rb', line 23

def obj
  @obj
end