Sha256: 75a58dee04a3c2f4379287007bcc8f57a2d2904dcda20e491cd720ed8aaabe15

Contents?: true

Size: 439 Bytes

Versions: 1

Compression:

Stored size: 439 Bytes

Contents

module Falling
  module Messaging
    class Message
      def initialize(text)
        @text = text
      end

      def height(at_width:)
        raise "not enough screen space" if at_width < 24
        format(for_width: at_width).length
      end

      # FIXME: One day we will properly break words.
      def format(for_width:)
        text.scan(/.{1,#{for_width}}/)
      end

      private

      attr_reader :text
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
falling-0.0.1 lib/falling/messaging/message.rb