Module: Dry::Logic::Appliable
- Defined in:
- lib/dry/logic/appliable.rb
Instance Method Summary collapse
- #applied? ⇒ Boolean
- #failure? ⇒ Boolean
- #id ⇒ Object
- #result ⇒ Object
- #success? ⇒ Boolean
- #to_ast ⇒ Object
Instance Method Details
#applied? ⇒ Boolean
12 13 14 |
# File 'lib/dry/logic/appliable.rb', line 12 def applied? !result.nil? end |
#failure? ⇒ Boolean
20 21 22 |
# File 'lib/dry/logic/appliable.rb', line 20 def failure? !success? end |
#id ⇒ Object
4 5 6 |
# File 'lib/dry/logic/appliable.rb', line 4 def id [:id] end |
#result ⇒ Object
8 9 10 |
# File 'lib/dry/logic/appliable.rb', line 8 def result [:result] end |
#success? ⇒ Boolean
16 17 18 |
# File 'lib/dry/logic/appliable.rb', line 16 def success? result.equal?(true) end |
#to_ast ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/dry/logic/appliable.rb', line 24 def to_ast if applied? && id [success? ? :success : :failure, [id, ast]] else ast end end |