Method: Musa::GenerativeGrammar::Implementation::Node#limit
- Defined in:
- lib/musa-dsl/generative/generative-grammar.rb
#limit(attribute = nil, after_collect_operation = nil, comparison_method = nil, comparison_value = nil) {|option| ... } ⇒ ConditionNode
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Limits generated options by condition.
Filters options to only those satisfying the given condition. Can use simplified arguments or custom block.
270 271 272 273 274 275 276 |
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 270 def limit(attribute = nil, after_collect_operation = nil, comparison_method = nil, comparison_value = nil, &block) raise ArgumentError, 'Cannot use simplified arguments and yield block at the same time' if (attribute || after_collect_operation || comparison_method || comparison_value) && @block block ||= generate_simple_condition_block(attribute, after_collect_operation, comparison_method, comparison_value) ConditionNode.new(self, &block) end |