Sha256: 1a544c1d89aea6ac2b1e18f980e0746aba70721f9d34c52d137359e60e77f63e

Contents?: true

Size: 461 Bytes

Versions: 4

Compression:

Stored size: 461 Bytes

Contents

module Vedeu
  class Position
    class << self
      def set(y = nil, x = nil)
        return '' if y.nil? || x.nil?

        new(y, x).set
      end

      def reset
        new(1, 1).set
      end
    end

    def initialize(y = 1, x = 1)
      @y, @x = y, x
    end

    def set
      [Esc.esc, y, ';', x, 'H'].join
    end

    private

    attr_accessor :y, :x

    def y
      @y == 0 ? 1 : @y
    end

    def x
      @x == 0 ? 1 : @x
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.0.25 lib/vedeu/output/position.rb
vedeu-0.0.24 lib/vedeu/output/position.rb
vedeu-0.0.23 lib/vedeu/output/position.rb
vedeu-0.0.22 lib/vedeu/output/position.rb