Sha256: 3cb51027adbf1c13c910a590aba16250614b27e79c32a6715c2218db6eac508d

Contents?: true

Size: 608 Bytes

Versions: 1

Compression:

Stored size: 608 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(), x_padding())
      @win.addstr(@prompt)
    end

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

    def data
      @data
    end 

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ppcurses-0.0.21 lib/ppcurses/actions/PromptAction.rb