Class: Dry::Logic::Operations::Unary
- Defined in:
- lib/dry/logic/operations/unary.rb
Instance Attribute Summary collapse
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
Attributes inherited from Abstract
Instance Method Summary collapse
- #ast(input = Undefined) ⇒ Object
-
#initialize(*rules, **options) ⇒ Unary
constructor
A new instance of Unary.
- #to_s ⇒ Object
Methods inherited from Abstract
#curry, #id, #new, #to_ast, #with
Methods included from Dry::Logic::Operators
Constructor Details
#initialize(*rules, **options) ⇒ Unary
Returns a new instance of Unary.
11 12 13 14 |
# File 'lib/dry/logic/operations/unary.rb', line 11 def initialize(*rules, **) super @rule = rules.first end |
Instance Attribute Details
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
9 10 11 |
# File 'lib/dry/logic/operations/unary.rb', line 9 def rule @rule end |
Instance Method Details
#ast(input = Undefined) ⇒ Object
16 17 18 |
# File 'lib/dry/logic/operations/unary.rb', line 16 def ast(input = Undefined) [type, rule.ast(input)] end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/dry/logic/operations/unary.rb', line 20 def to_s "#{type}(#{rule})" end |