Method: MTK::Pattern::AbstractPattern#initialize

Defined in:
lib/mtk/pattern/abstract_pattern.rb

#initialize(elements, options = {}) ⇒ AbstractPattern

Returns a new instance of AbstractPattern.

Parameters:

  • the list of elements in the pattern

  • (defaults to: {})

    the pattern options

Options Hash (options):



34
35
36
37
38
39
40
41
# File 'lib/mtk/pattern/abstract_pattern.rb', line 34

def initialize(elements, options={})
  elements = elements.to_a if elements.respond_to? :to_a and not elements.is_a? Proc # Proc check prevents warnings in Ruby 1.8
  @elements = elements
  @options = options
  @type = options[:type]
  @max_elements = options[:max_elements]
  rewind
end