Sha256: ec5f8814b4a74685bc434680fb9ec4bc95071e25f4717b9b44042f0469b1650e

Contents?: true

Size: 721 Bytes

Versions: 1

Compression:

Stored size: 721 Bytes

Contents

require_relative 'pane/chapter'
require_relative 'pane/code'
require_relative 'pane/list'
require_relative 'pane/text'
require_relative 'pane/console'

module TermNote
  module Pane
    attr_accessor :show, :height, :width, :rows

    def call(window_size)
      window_height, window_width = window_size
      @width = window_width
      @height = window_height
      clear
      render
    end

    private

    def clear
      system("clear")
    end

    def render
      puts show.header + space + formated_rows + space
    end

    def space
      "\n" * (height / 2)
    end

    def formated_rows
      rows.map { |row| gutter + row }.join("\n")
    end

    def gutter
      " " * (width / 10)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
termnote-1.1.0 lib/termnote/pane.rb