Sha256: fdef917f13ee111479761e78c213fe274fd3c882f1d256f5047053cbf3bd706b

Contents?: true

Size: 488 Bytes

Versions: 1

Compression:

Stored size: 488 Bytes

Contents

module TerminalNotes
    class Cursor
        attr_reader :x, :y

        def initialize(x: 0, y: 0)
            @x = x.to_i
            @y = y.to_i
        end

        def moveBy(deltaX = 0, deltaY = 0)
            @x += deltaX
            @y += deltaY
            self
        end

        def moveTo(x: nil, y: nil)
            @x = x unless x.nil?
            @y = y unless y.nil?
            self
        end

        def to_hash
            { x: @x, y: @y }
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
terminal-notes-0.0.1 lib/terminal-notes/cursor.rb