Sha256: d71753a7d8081be1a2f64181d8e23dfec55c6a953b70ebf68c8aa58703cc4f87

Contents?: true

Size: 730 Bytes

Versions: 7

Compression:

Stored size: 730 Bytes

Contents

module Lapidarius
  class Renderer
    class NoEntGemError< ArgumentError; end

    def initialize(gem:, recursive: false)
      fail NoEntGemError, "gem not found on this system!" unless gem
      @gem = gem
      @recursive = recursive
      @out = []
    end

    def call(io = STDOUT)
      io.puts out
    end

    def out
      header
      body
      @out
    end

    private def header
      @out << ("\n#{@gem.fullname}".ljust(28) << "#{@gem.deep_count}".rjust(3))
      @out << hr
    end

    private def body
      return if @gem.deps.empty?
      @gem.deps.each do |dep|
        @out << dep.to_s(recursive: @recursive)
      end
      @out << "\n"
    end

    private def hr
      "#{"-" * 30}\n"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lapidarius-2.0.1 lib/lapidarius/renderer.rb
lapidarius-1.1.4 lib/lapidarius/renderer.rb
lapidarius-1.1.3 lib/lapidarius/renderer.rb
lapidarius-1.1.2 lib/lapidarius/renderer.rb
lapidarius-1.1.1 lib/lapidarius/renderer.rb
lapidarius-1.1.0 lib/lapidarius/renderer.rb
lapidarius-1.0.0 lib/lapidarius/renderer.rb