Module: Hamlit::Concerns::Ripperable

Included in:
Hamlit::Compilers::NewAttribute, Hamlit::Compilers::OldAttribute
Defined in:
lib/hamlit/concerns/ripperable.rb

Constant Summary collapse

TYPE_POSITION =
1

Instance Method Summary collapse

Instance Method Details

#skip_tokens!(tokens, *types) ⇒ Object



8
9
10
11
12
# File 'lib/hamlit/concerns/ripperable.rb', line 8

def skip_tokens!(tokens, *types)
  while types.include?(type_of(tokens.first))
    tokens.shift
  end
end

#type_of(token) ⇒ Object



14
15
16
17
# File 'lib/hamlit/concerns/ripperable.rb', line 14

def type_of(token)
  return nil unless token
  token[TYPE_POSITION]
end