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.
9 10 11 12 |
# File 'lib/dry/logic/operations/unary.rb', line 9 def initialize(*rules, **) super @rule = rules.first end |
Instance Attribute Details
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
7 8 9 |
# File 'lib/dry/logic/operations/unary.rb', line 7 def rule @rule end |
Instance Method Details
#ast(input = Undefined) ⇒ Object
14 15 16 |
# File 'lib/dry/logic/operations/unary.rb', line 14 def ast(input = Undefined) [type, rule.ast(input)] end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/dry/logic/operations/unary.rb', line 18 def to_s "#{type}(#{rule})" end |