Class: Luck::CommandBox

Inherits:
TextBox show all
Defined in:
lib/luck/textbox.rb

Instance Attribute Summary

Attributes inherited from TextBox

#handler, #index, #mask, #multiline

Attributes inherited from Label

#alignment, #text

Attributes inherited from Control

#display, #pane, #x1, #x2, #y1, #y2

Instance Method Summary collapse

Methods inherited from TextBox

#handle_char, #initialize, #on_submit, #redraw, #text, #value=

Methods inherited from Label

#align, #align_text, #initialize, #redraw

Methods inherited from Control

#focus!, #height, #initialize, #width

Constructor Details

This class inherits a constructor from Luck::TextBox

Instance Method Details

#command?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/luck/textbox.rb', line 81

def command?
  @text[0,1] == '/'
end

#labelObject



85
86
87
# File 'lib/luck/textbox.rb', line 85

def label
  command? ? 'Command' : @label
end

#valueObject



89
90
91
# File 'lib/luck/textbox.rb', line 89

def value
  command? ? super[1..-1] : super
end