Module: HashSyntax::Transformer

Extended by:
Transformer
Included in:
Transformer
Defined in:
lib/hash_syntax/transformer.rb

Constant Summary collapse

MATCH_18 =
ObjectRegex.new('symbeg (ident | kw) sp? hashrocket')
MATCH_19 =
ObjectRegex.new('label')

Instance Method Summary collapse

Instance Method Details

#transform(input_text, options) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/hash_syntax/transformer.rb', line 8

def transform(input_text, options)
  tokens = extract_tokens(input_text)
  if options[:"to-18"]
    transform_to_18(input_text, tokens, options)
  elsif options[:"to-19"]
    transform_to_19(input_text, tokens, options)
  else
    raise ArgumentError.new('Either :to_18 or :to_19 must be specified.')
  end
end