class Cobi::Field

Attributes

focused[RW]
length[RW]
text[RW]
value[RW]

Public Class Methods

new(text, length) click to toggle source
# File lib/cobi/field.rb, line 4
def initialize(text, length)
  @text = text
  @length = length
  @focused = false
  @value = ''
end

Public Instance Methods

focused?() click to toggle source
# File lib/cobi/field.rb, line 16
def focused?
  !!focused
end
to_s() click to toggle source
# File lib/cobi/field.rb, line 11
def to_s
  pastel_ctx = focused? ? Pastel.new.on_white : Pastel.new.on_black
  pastel_ctx.blue(text + ': ') + pastel_ctx.green(value + '_' * (length - value.length))
end