Sha256: a9f087d8e42cac02f73c7e2ee39f5e909c5b5ddb8477aabc98063fd9bf7db19b

Contents?: true

Size: 914 Bytes

Versions: 10

Compression:

Stored size: 914 Bytes

Contents

require "curses"

class LiftAction < GetDataAction 

  def initialize(nameMenu, repMenu, db)
    @nameMenu = nameMenu
    @repMenu = repMenu
    @db = db
    
    @prompt  = GetIntegerAction.new("Weight (pounds) : ") 
    super( [ @prompt ] )

    @sql = "INSERT into LIFTS(name, weight, reps) values ('%s', %s, %s)"                 

  end

  def winHeight()
     return 9
  end
 
  def liftName()
    @nameMenu.getSelectedMenuName()
  end
  
  def repsName()
    @repMenu.getSelectedMenuName()
  end
  
  def repsInteger()
    return Integer(repsName().chars.first).to_s
  end

  def beforeActions()
    self.printLine("Input data for " + repsName() + " " + liftName() )
  end

  def afterActions()
    preparedSql = @sql.sub("%s", liftName() )
    preparedSql = preparedSql.sub("%s", @prompt.data() )
    preparedSql = preparedSql.sub("%s", repsInteger() )

    self.promptToChangeData(preparedSql)
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ppcurses-0.0.17 lib/ppcurses/actions/LiftAction.rb
ppcurses-0.0.16 lib/ppcurses/actions/LiftAction.rb
ppcurses-0.0.15 lib/ppcurses/actions/LiftAction.rb
ppcurses-0.0.14 lib/ppcurses/actions/LiftAction.rb
ppcurses-0.0.13 lib/ppcurses/actions/LiftAction.rb
ppcurses-0.0.12 lib/ppcurses/actions/LiftAction.rb
ppcurses-0.0.11 lib/ppcurses/actions/LiftAction.rb
ppcurses-0.0.10 lib/ppcurses/actions/LiftAction.rb
ppcurses-0.0.9 lib/ppcurses/actions/LiftAction.rb
ppcurses-0.0.8 lib/ppcurses/actions/LiftAction.rb