lib/ppcurses/actions/GetDataAction.rb in ppcurses-0.0.20 vs lib/ppcurses/actions/GetDataAction.rb in ppcurses-0.0.21

- old
+ new

@@ -1,87 +1,87 @@ 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.setParentAction(self) + action.set_parent_action(self) end end end - def beforeActions() + def before_actions # Stub for classes that extend end - def afterActions() + def after_actions # Stub for classes that extend end - def data() + def data values = [] @actions.each do |action| values.push(action.data()) end - return values + values end - def createWindow() + def create_window super() # Assign window to actions unless @actions.nil? @actions.each do |action| - action.setWindow(@win) + action.set_window(@win) end end end - def execute() - createWindow() + def execute + create_window() echo - @win.setpos(@win.cury,xPadding()) + @win.setpos(@win.cury,x_padding()) - self.beforeActions() + self.before_actions() @actions.each do |action| action.execute end - self.afterActions() + self.after_actions() noecho @win.clear @win.refresh @win.close end - def printLine(string) - @win.setpos(@win.cury(), winPadding()) + def print_line(string) + @win.setpos(@win.cury(), win_padding()) @win.addstr(string) - @win.setpos(@win.cury() + 1, winPadding()) + @win.setpos(@win.cury() + 1, win_padding()) end - def printSuccessLine(string) + def print_success_line(string) init_pair(1, COLOR_GREEN, COLOR_BLACK) @win.attron(color_pair(1)) - self.printLine(string) + self.print_line(string) @win.attroff(color_pair(1)) end - def printErrorLine(string) + def print_error_line(string) init_pair(1, COLOR_RED, COLOR_BLACK) @win.attron(color_pair(1)) - self.printLine(string) + self.print_line(string) @win.attroff(color_pair(1)) end