Module: SnippetCli::FormFieldParser

Defined in:
lib/snippet_cli/form_field_parser.rb

Overview

Parses [[field_name]] placeholders from form variable layout strings.

Constant Summary collapse

PATTERN =
/\[\[\s*(\w+)\s*\]\]/

Class Method Summary collapse

Class Method Details

.extract(layout) ⇒ Object

Returns an array of field name strings extracted from the layout.



9
10
11
# File 'lib/snippet_cli/form_field_parser.rb', line 9

def self.extract(layout)
  layout.to_s.scan(PATTERN).flatten
end