Method: CodeLexer::Token.from_string

Defined in:
lib/code-lexer/token.rb

.from_string(string) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/code-lexer/token.rb', line 14

def self.from_string(string)
    unless string.start_with?(SPECIAL_TOKEN_OPEN)
        value = string
    else
        value = nil
    end
    
    token = Token.new(:unknown, value)
    token.abstracted_value = string
    
    return token
end