Class: Gherkin::TagExpression
- Inherits:
-
Object
- Object
- Gherkin::TagExpression
- Defined in:
- lib/gherkin/tag_expression.rb
Instance Attribute Summary collapse
-
#limits ⇒ Object
readonly
Returns the value of attribute limits.
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #eval(tags) ⇒ Object
-
#initialize(tag_expressions) ⇒ TagExpression
constructor
A new instance of TagExpression.
Constructor Details
#initialize(tag_expressions) ⇒ TagExpression
Returns a new instance of TagExpression.
9 10 11 12 13 14 15 |
# File 'lib/gherkin/tag_expression.rb', line 9 def initialize(tag_expressions) @ands = [] @limits = {} tag_expressions.each do |expr| add(expr.strip.split(/\s*,\s*/)) end end |
Instance Attribute Details
#limits ⇒ Object (readonly)
Returns the value of attribute limits.
7 8 9 |
# File 'lib/gherkin/tag_expression.rb', line 7 def limits @limits end |
Instance Method Details
#empty? ⇒ Boolean
17 18 19 |
# File 'lib/gherkin/tag_expression.rb', line 17 def empty? @ands.empty? end |
#eval(tags) ⇒ Object
21 22 23 24 25 |
# File 'lib/gherkin/tag_expression.rb', line 21 def eval() return true if @ands.flatten.empty? vars = Hash[*.map{|tag| [tag, true]}.flatten] !!Kernel.eval(ruby_expression) end |