Sha256: d5474b9b84ab8008b70c536f359717df14ef9b75f0e47e4bd5ff3aa357a4196f
Contents?: true
Size: 790 Bytes
Versions: 2
Compression:
Stored size: 790 Bytes
Contents
require "lapidarius/gem" require "lapidarius/command" module Lapidarius class Cutter DEVELOPMENT = "development" def initialize(gem:, cmd_klass: Command) @gem = gem @cmd = cmd_klass.new end def call(src = cmd, gem = nil) tokens = tokenize(src) token = tokens.shift gem ||= Gem.factory(token) tokens.each do |t| dep = Gem.factory(t) next unless dep gem << dep call(cmd(dep.name), dep) end gem end private def tokenize(src) src = src.split(/\n\n/).first src.split("\n").tap do |tokens| tokens.map!(&:strip) tokens.reject! { |token| token.match(/#{DEVELOPMENT}/) } end end private def cmd(gem = @gem) @cmd.call(gem) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lapidarius-1.1.0 | lib/lapidarius/cutter.rb |
lapidarius-1.0.0 | lib/lapidarius/cutter.rb |