Class: Dry::Logic::Operations::Abstract
- Inherits:
-
Object
- Object
- Dry::Logic::Operations::Abstract
- Includes:
- Core::Constants, Dry::Logic::Operators
- Defined in:
- lib/dry/logic/operations/abstract.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
- #curry(*args) ⇒ Object
- #id ⇒ Object
-
#initialize(*rules, **options) ⇒ Abstract
constructor
A new instance of Abstract.
- #new(rules, **new_options) ⇒ Object
- #to_ast ⇒ Object
- #with(new_options) ⇒ Object
Methods included from Dry::Logic::Operators
Constructor Details
#initialize(*rules, **options) ⇒ Abstract
Returns a new instance of Abstract.
17 18 19 20 |
# File 'lib/dry/logic/operations/abstract.rb', line 17 def initialize(*rules, **) @rules = rules @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
15 16 17 |
# File 'lib/dry/logic/operations/abstract.rb', line 15 def @options end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
13 14 15 |
# File 'lib/dry/logic/operations/abstract.rb', line 13 def rules @rules end |
Instance Method Details
#curry(*args) ⇒ Object
26 27 28 |
# File 'lib/dry/logic/operations/abstract.rb', line 26 def curry(*args) new(rules.map { |rule| rule.curry(*args) }, ) end |
#id ⇒ Object
22 23 24 |
# File 'lib/dry/logic/operations/abstract.rb', line 22 def id [:id] end |
#new(rules, **new_options) ⇒ Object
30 31 32 |
# File 'lib/dry/logic/operations/abstract.rb', line 30 def new(rules, **) self.class.new(*rules, .merge()) end |
#to_ast ⇒ Object
38 39 40 |
# File 'lib/dry/logic/operations/abstract.rb', line 38 def to_ast ast end |
#with(new_options) ⇒ Object
34 35 36 |
# File 'lib/dry/logic/operations/abstract.rb', line 34 def with() new(rules, .merge()) end |