Sha256: f8f537b81ce3732260d2904a9247a682f9c50b55334e620d0c7d5caedc212342

Contents?: true

Size: 602 Bytes

Versions: 4

Compression:

Stored size: 602 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
      echo
      @data = @win.getstr
      noecho
    end

    def data
      @data
    end 

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ppcurses-0.0.25 lib/ppcurses/actions/PromptAction.rb
ppcurses-0.0.24 lib/ppcurses/actions/PromptAction.rb
ppcurses-0.0.23 lib/ppcurses/actions/PromptAction.rb
ppcurses-0.0.22 lib/ppcurses/actions/PromptAction.rb