Class: RBlade::CompilesComponents

Inherits:
Object
  • Object
show all
Defined in:
lib/rblade/compiler/compiles_components.rb

Instance Method Summary collapse

Instance Method Details

#compile!(tokens) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rblade/compiler/compiles_components.rb', line 5

def compile!(tokens)
  tokens.each do |token|
    if [:component, :component_start, :component_end].none? token.type
      next
    end

    token.value = if token.type == :component_start
      compile_token_start token
    elsif token.type == :component_end
      compile_token_end token
    else
      compile_token_start(token) + compile_token_end(token)
    end
  end
end