Method: Musa::GenerativeGrammar::Implementation::Node#options
- Defined in:
- lib/musa-dsl/generative/generative-grammar.rb
#options(attribute = nil, after_collect_operation = nil, comparison_method = nil, comparison_value = nil, raw: nil, content: nil) {|option| ... } ⇒ Array
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.
Generates all options from this grammar node.
Produces all valid combinations matching the grammar definition. Can filter with condition and control output format.
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'lib/musa-dsl/generative/generative-grammar.rb', line 333 def (attribute = nil, after_collect_operation = nil, comparison_method = nil, comparison_value = nil, raw: nil, content: nil, &condition) raise ArgumentError, 'Cannot use simplified arguments and yield block at the same time' if (attribute || after_collect_operation || comparison_method || comparison_value) && @condition raise ArgumentError, 'Cannot use raw: true and content: option at the same time' if raw && content raw ||= false content ||= :itself condition ||= generate_simple_condition_block(attribute, after_collect_operation, comparison_method, comparison_value) if raw (&condition) else (&condition).collect { |o| o.collect(&:content).send(content) } end end |