Class: Rink::Lexer

Inherits:
RubyLex show all
Extended by:
Delegation
Defined in:
lib/rink/lexer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Delegation

delegate

Constructor Details

#initialize(output = nil) ⇒ Lexer

Returns a new instance of Lexer.



9
10
11
12
# File 'lib/rink/lexer.rb', line 9

def initialize(output = nil)
  @output = output
  super()
end

Instance Attribute Details

#outputObject

Returns the value of attribute output.



6
7
8
# File 'lib/rink/lexer.rb', line 6

def output
  @output
end

Instance Method Details

#set_prompt(p = nil, &block) ⇒ Object

RubyLex prompts unconditionally once the prompt is first set (not very reset-friendly), so we need to fix that.



15
16
17
18
19
20
21
# File 'lib/rink/lexer.rb', line 15

def set_prompt(p = nil, &block)
  if p.nil? && !block_given?
    @prompt = nil # this will go back to NOT prompting
  else
    super
  end
end