class Minder::FilterFrame

Attributes

filter_string[R]

Public Class Methods

new(*) click to toggle source
Calls superclass method
# File lib/minder/cli/filter_frame.rb, line 7
def initialize(*)
  super
  @filter_string = ''
end

Public Instance Methods

desired_height() click to toggle source
# File lib/minder/cli/filter_frame.rb, line 12
def desired_height
  3
end
handle_char_keypress(key) click to toggle source
# File lib/minder/cli/filter_frame.rb, line 26
def handle_char_keypress(key)
  return unless key

  @filter_string += key
  refresh
  changed
  notify_observers(:update_filter, { text: filter_string })
end
handle_non_char_keypress(key) click to toggle source
# File lib/minder/cli/filter_frame.rb, line 35
def handle_non_char_keypress(key)
  if key == 10
    changed
    notify_observers(:submit_filter, { text: filter_string })
  end

  @filter_string.chop! if [Curses::Key::BACKSPACE, 127].include?(key)

  refresh
  changed
  notify_observers(:update_filter, { text: filter_string })
end
set_cursor_position() click to toggle source
# File lib/minder/cli/filter_frame.rb, line 22
def set_cursor_position
  window.setpos(1, filter_string.length + 9)
end
template() click to toggle source
# File lib/minder/cli/filter_frame.rb, line 16
    def template
      <<-TEXT
Filter: #{filter_string}
TEXT
    end