Class: Validation
Class Method Summary collapse
Instance Method Summary collapse
Methods included from ADT
Class Method Details
.fail_with(error) ⇒ Object
10 11 12 |
# File 'lib/data/validation.rb', line 10 def self.fail_with(error) failure([error]) end |
Instance Method Details
#bind(&b) ⇒ Object
18 19 20 |
# File 'lib/data/validation.rb', line 18 def bind(&b) fold(proc { |_| self }, b) end |
#map ⇒ Object
14 15 16 |
# File 'lib/data/validation.rb', line 14 def map fold(proc { |_| self }, proc { |v| Validation.success(yield v) }) end |