Class: Colloquy::Prompt

Inherits:
Object
  • Object
show all
Includes:
Paginator
Defined in:
lib/colloquy/prompt.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Paginator

included

Constructor Details

#initialize(options = {}) ⇒ Prompt

Returns a new instance of Prompt.



7
8
9
10
11
# File 'lib/colloquy/prompt.rb', line 7

def initialize(options = {})
  @message = options[:message] || ''
  @page = options[:page] || 1
  @flow = options[:flow] || nil
end

Instance Attribute Details

#flowObject

Returns the value of attribute flow.



5
6
7
# File 'lib/colloquy/prompt.rb', line 5

def flow
  @flow
end

Instance Method Details

#==(string) ⇒ Object



20
21
22
# File 'lib/colloquy/prompt.rb', line 20

def ==(string)
  @message == string
end

#freezeObject



24
25
26
# File 'lib/colloquy/prompt.rb', line 24

def freeze
  @message.freeze
end

#key(input) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/colloquy/prompt.rb', line 28

def key(input)
  if input.to_s == '1'
    :more
  else
    :unknown
  end
end

#render(page = @page) ⇒ Object



13
14
15
16
17
18
# File 'lib/colloquy/prompt.rb', line 13

def render(page = @page)
  paginate unless @pages
  
  execute_before_page_hook
  "#{render_body(page)}"
end