Class: Dnf::BooleanExpression
- Inherits:
-
Object
- Object
- Dnf::BooleanExpression
- Defined in:
- lib/dnf/boolean_expression.rb
Constant Summary collapse
- DEFAULT_CONFIG =
{ variable_regex: /\w+/, not_symbol: '!', and_symbol: '&', or_symbol: '|' }
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#expression ⇒ Object
readonly
Returns the value of attribute expression.
Instance Method Summary collapse
-
#initialize(expression, custom_config = {}) ⇒ BooleanExpression
constructor
A new instance of BooleanExpression.
- #to_dnf ⇒ Object
Constructor Details
#initialize(expression, custom_config = {}) ⇒ BooleanExpression
Returns a new instance of BooleanExpression.
12 13 14 15 |
# File 'lib/dnf/boolean_expression.rb', line 12 def initialize(expression, custom_config = {}) @expression = expression @config = DEFAULT_CONFIG.merge(custom_config) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/dnf/boolean_expression.rb', line 3 def config @config end |
#expression ⇒ Object (readonly)
Returns the value of attribute expression.
3 4 5 |
# File 'lib/dnf/boolean_expression.rb', line 3 def expression @expression end |
Instance Method Details
#to_dnf ⇒ Object
17 18 19 20 21 |
# File 'lib/dnf/boolean_expression.rb', line 17 def to_dnf expr = parse(expression) dnf = convert_to_dnf(expr) dnf_to_string(dnf) end |