Method: TemplateExpander#initialize
- Defined in:
- lib/HDLRuby/template_expander.rb
#initialize(rules = []) ⇒ TemplateExpander
Creates a new template expander with potential list of +rules+.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/HDLRuby/template_expander.rb', line 17 def initialize(rules= []) # Setup the rules. @rules = rules.map do |match,action| # Ensures action is a proc. action = proc { |str| action.to_s } unless action.is_a?(Proc) # Create the rule. Rule.new(Regexp.new(match), action) end # The skip regexp is empty, it has to be built with finalize. @skip = nil end |