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
14 15 16 |
# File 'lib/dry/logic/appliable.rb', line 14 def applied? !result.nil? end |
#failure? ⇒ Boolean
22 23 24 |
# File 'lib/dry/logic/appliable.rb', line 22 def failure? !success? end |
#id ⇒ Object
6 7 8 |
# File 'lib/dry/logic/appliable.rb', line 6 def id [:id] end |
#result ⇒ Object
10 11 12 |
# File 'lib/dry/logic/appliable.rb', line 10 def result [:result] end |
#success? ⇒ Boolean
18 19 20 |
# File 'lib/dry/logic/appliable.rb', line 18 def success? result.equal?(true) end |
#to_ast ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/dry/logic/appliable.rb', line 26 def to_ast if applied? && id [success? ? :success : :failure, [id, ast]] else ast end end |