Class: Rubber::Tokenizer

Inherits:
Object
  • Object
show all
Defined in:
lib/rubber/tokens.rb

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Tokenizer

Returns a new instance of Tokenizer.


3
4
5
6
7
# File 'lib/rubber/tokens.rb', line 3

def initialize(file)
  @file = file
  @lines = IO.readlines(@file)
  @str = StringScanner.new(@string = @lines.join)
end

Instance Method Details

#next_tokenObject


9
10
11
# File 'lib/rubber/tokens.rb', line 9

def next_token
  @str.scan(/%[a-z_]+/)
end