Class: Yap::Shell::Prompt

Inherits:
Object
  • Object
show all
Defined in:
lib/yap/shell/prompt.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text:, &blk) ⇒ Prompt

Returns a new instance of Prompt.



5
6
7
8
# File 'lib/yap/shell/prompt.rb', line 5

def initialize(text:, &blk)
  @text = text
  @blk = blk
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



3
4
5
# File 'lib/yap/shell/prompt.rb', line 3

def text
  @text
end

Instance Method Details

#updateObject



14
15
16
17
18
19
# File 'lib/yap/shell/prompt.rb', line 14

def update
  if @blk
    @text = @blk.call
  end
  self
end