Sha256: 09ba1d3804f60975770fa2bb706e8dab947b69ea366b5d330fe5d5394a231911
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
require_relative 'BaseAction.rb' #noinspection RubyResolve module PPCurses # An action that contains an array of prompt actions. # It can be used to group together multiple prompt actions. # class GetDataAction < BaseAction def initialize( actions ) @actions = actions unless @actions.nil? @actions.each do |action| action.set_parent_action(self) end end end def before_actions # Stub for classes that extend end def after_actions # Stub for classes that extend end def data values = [] @actions.each do |action| values.push( action.data ) end values end def create_window super() # Assign window to actions unless @actions.nil? @actions.each do |action| action.set_window(@win) end end end def execute create_window Curses.echo @win.setpos(@win.cury, x_padding ) self.before_actions @actions.each do |action| action.execute end self.after_actions Curses.noecho @win.clear @win.refresh @win.close end def print_line(string) @win.setpos(@win.cury, win_padding) @win.addstr(string) @win.setpos(@win.cury + 1, win_padding) end def print_success_line(string) Curses.init_pair(1, COLOR_GREEN, COLOR_BLACK) @win.attron(color_pair(1)) self.print_line(string) @win.attroff(color_pair(1)) end def print_error_line(string) Curses.init_pair(1, COLOR_RED, COLOR_BLACK) @win.attron(color_pair(1)) self.print_line(string) @win.attroff(color_pair(1)) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ppcurses-0.1.1 | lib/ppcurses/actions/GetDataAction.rb |
ppcurses-0.1.0 | lib/ppcurses/actions/GetDataAction.rb |