Module: TagParser::ClassMethods
- Defined in:
- lib/cooklang_rb/tag_parser.rb
Instance Method Summary collapse
Instance Method Details
#multi_word_pattern ⇒ Object
32 33 34 |
# File 'lib/cooklang_rb/tag_parser.rb', line 32 def multi_word_pattern /#{tag}#{MULTI_NAME}{#{QUANTITY}}/ end |
#parse_from(buffer) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/cooklang_rb/tag_parser.rb', line 24 def parse_from(buffer) if buffer.match? multi_word_pattern new(**multi_word_pattern.match(buffer.scan(multi_word_pattern)).named_captures.transform_keys(&:to_sym)) else new(name: buffer.scan(single_word_pattern)) end end |
#single_word_pattern ⇒ Object
36 37 38 |
# File 'lib/cooklang_rb/tag_parser.rb', line 36 def single_word_pattern /#{tag}#{NAME}/ end |