Sha256: 9a8488cb911135ebb5f52840a72f67b455209580a1816acb166a434a73be9c9e

Contents?: true

Size: 541 Bytes

Versions: 2

Compression:

Stored size: 541 Bytes

Contents

# frozen_string_literal: true

module RubyJard
  class Span
    extend Forwardable

    attr_accessor :content, :content_length, :styles

    def initialize(content: '', content_length: nil, margin_left: 0, margin_right: 0, styles: [])
      if !content.nil? && !content.empty?
        content = ' ' * margin_left + content if margin_left > 0
        content += ' ' * margin_right if margin_right > 0
      end

      @content = content.to_s
      @content_length = content_length || @content.length
      @styles = styles
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby_jard-0.2.2 lib/ruby_jard/span.rb
ruby_jard-0.2.1 lib/ruby_jard/span.rb