Class: Results::Bad
- Inherits:
-
Struct
- Object
- Struct
- Results::Bad
- Defined in:
- lib/results.rb
Defined Under Namespace
Classes: And
Instance Attribute Summary collapse
-
#why ⇒ Object
Returns the value of attribute why.
Instance Method Summary collapse
- #and ⇒ Object
- #flat_map ⇒ Object (also: #validate)
-
#initialize(*args) ⇒ Bad
constructor
A new instance of Bad.
- #map ⇒ Object
- #validate_all(*validations) ⇒ Object
- #when(msg_or_proc) ⇒ Object
- #when_all(*filters) ⇒ Object
- #when_all_not(*filters) ⇒ Object
- #when_not(msg_or_proc) ⇒ Object
- #zip(other) ⇒ Object
Constructor Details
Instance Attribute Details
#why ⇒ Object
Returns the value of attribute why
148 149 150 |
# File 'lib/results.rb', line 148 def why @why end |
Instance Method Details
#flat_map ⇒ Object Also known as: validate
158 159 160 |
# File 'lib/results.rb', line 158 def flat_map self end |
#map ⇒ Object
154 155 156 |
# File 'lib/results.rb', line 154 def map self end |
#validate_all(*validations) ⇒ Object
212 213 214 |
# File 'lib/results.rb', line 212 def validate_all(*validations) validations.flatten.inject(self) { |prev_result, validation| prev_result.and.validate(&validation) } end |
#when(msg_or_proc) ⇒ Object
164 165 166 |
# File 'lib/results.rb', line 164 def when(msg_or_proc) self end |
#when_all(*filters) ⇒ Object
204 205 206 |
# File 'lib/results.rb', line 204 def when_all(*filters) filters.flatten.inject(self) { |prev_result, filter| prev_result.and.when(filter) } end |
#when_all_not(*filters) ⇒ Object
208 209 210 |
# File 'lib/results.rb', line 208 def when_all_not(*filters) filters.flatten.inject(self) { |prev_result, filter| prev_result.and.when_not(filter) } end |
#when_not(msg_or_proc) ⇒ Object
168 169 170 |
# File 'lib/results.rb', line 168 def when_not(msg_or_proc) self end |