Module: Antlers::IfLexeme

Extended by:
IfLexeme
Includes:
Lexeme
Included in:
IfLexeme
Defined in:
lib/lexemes/if_lexeme.rb

Constant Summary collapse

KEYWORDS =
['if:', ':if'].freeze

Instance Method Summary collapse

Instance Method Details

#lexeme(keywords:) ⇒ Object



16
17
18
19
20
# File 'lib/lexemes/if_lexeme.rb', line 16

def lexeme(keywords:, **)
  return { if_def: keywords['if:'] } if keywords.key?('if:')

  { if_end: 'level_1' }
end

#match?(keywords:) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/lexemes/if_lexeme.rb', line 12

def match?(keywords:, **)
  KEYWORDS.include?(keywords.keys.first)
end