Class: Prompter

Inherits:
Object
  • Object
show all
Extended by:
Methods
Includes:
Methods
Defined in:
lib/prompter.rb

Overview

Author:

  • Domizio Demichelis

Defined Under Namespace

Modules: Methods

Constant Summary collapse

VERSION =
File.read(File.expand_path('../../VERSION', __FILE__)).strip

Class Attribute Summary collapse

Attributes included from Methods

#echo, #prefix

Instance Method Summary collapse

Methods included from Methods

ask, ask_multiline, choose, choose_index, choose_many, choose_many_index, no?, say, say_notice, say_warning, yes?, yes_no?

Constructor Details

#initialize(opts = {}) {|| ... } ⇒ Prompter

Standard constructor, also accepts a block

Parameters:

  • opts (Hash) (defaults to: {})

    The options to create a Prompter object.

Options Hash (opts):

  • :prefix (String)

    The prefix string

  • :echo (Boolean)

    when true adds a line with the result

Yields:

  • yields the block with self

Yield Parameters:



27
28
29
30
31
# File 'lib/prompter.rb', line 27

def initialize(opts={})
  @prefix = opts[:prefix]
  @echo = opts[:echo] || true
  yield self if block_given?
end

Class Attribute Details

.dye_stylesObject

Returns the value of attribute dye_styles.



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

def dye_styles
  @dye_styles
end