Class: Inquirer::Style

Inherits:
Object
  • Object
show all
Defined in:
lib/inquirer/style.rb,
lib/inquirer/style/list.rb,
lib/inquirer/style/input.rb,
lib/inquirer/style/confirm.rb,
lib/inquirer/style/checkbox.rb,
lib/inquirer/style/password.rb,
lib/inquirer/style/list_filterable.rb,
lib/inquirer/style/checkbox_filterable.rb

Direct Known Subclasses

Checkbox, Confirm, Input, List

Defined Under Namespace

Classes: Checkbox, CheckboxFilterable, Confirm, Input, List, ListFilterable, Password

Constant Summary collapse

@@question_prefix =
Rainbow('?').green + ' '
@@seperator =
'--------'
@@question =
'%s '
@@response =
Rainbow('%s').cyan
@@selector =
Rainbow('').cyan
@@checkbox_on =
Rainbow('').green
@@checkbox_off =
''
@@pagiator_text =
'(Move up and down to reveal more choices)'
@@error_message =
Rainbow('>>').red + ' %s'
@@error_message_invalid_value =
'The entered value is not valid'
@@endless_repeat =
Rainbow('#%s').yellow
@@limited_repeat =
Rainbow('#%s of %s').yellow

Class Method Summary collapse

Class Method Details

.activate_getter_setterObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/inquirer/style.rb', line 26

def self.activate_getter_setter
  # this creates the methods when the class is loaded
  self.class_variables.each{ |sym|

    # build the meta syntax
    class_variable_getter_and_setter = <<EVALME

# getter
def self.#{sym.to_s.gsub('@@','')}
  #{sym}
end

# setter
def self.#{sym.to_s.gsub('@@','')}=(value)
  #{sym} = value
end;
EVALME
    class_eval(class_variable_getter_and_setter)
  }
end