Sha256: f06068d7e332c79854f2bfac7b8d1e7b6c4e8a407d702f4723b38f592f6ca3ca

Contents?: true

Size: 491 Bytes

Versions: 1

Compression:

Stored size: 491 Bytes

Contents

module Putsplus
	#
	# Sticks text to last line in console
	#	
	class Footer
		attr_reader :thread
		attr_accessor :text

		def initialize(text = "")
		@text = text
		@thread = Thread.new {
			while true do
				sticky_footer @text
			end
		}
		end

		def kill
			print " " * `tput cols`.to_i
			$stdout.flush
			Thread.kill(@thread)
		end

		def sticky_footer text
			print text.to_s + "\r"
			$stdout.flush
		end

		def alive?
			@thread.alive?
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
putsplus-0.1.1 lib/putsplus/footer.rb