Sha256: 53dd0122b886c56cb4262d261ca1fbef0330688ca65512128c29303d38d6a568

Contents?: true

Size: 616 Bytes

Versions: 2

Compression:

Stored size: 616 Bytes

Contents

require_relative 'BaseAction.rb'

#noinspection RubyResolve
module PPCurses
  class PromptAction < BaseAction

    def initialize(prompt)
      @prompt = prompt
    end

    def set_parent_action(action)
      @parent = action
    end

    def x_padding
      if @parent.nil?
        self.win_padding
      else
        @parent.win_padding
      end
    end

    def print_prompt
      @win.setpos(@win.cury, self.x_padding )
      @win.addstr(@prompt)
    end

    def execute
      print_prompt
      Curses.echo
      @data = @win.getstr
      Curses.noecho
    end

    def data
      @data
    end 

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ppcurses-0.1.1 lib/ppcurses/actions/PromptAction.rb
ppcurses-0.1.0 lib/ppcurses/actions/PromptAction.rb