Sha256: ac96ec657ecd52214342c17367543e5468ed7fd86331eff55ce59f1dbe5f9a96

Contents?: true

Size: 723 Bytes

Versions: 3

Compression:

Stored size: 723 Bytes

Contents

module Rocktumbler
  # The Group is a class responsible for outputting a gem group
  class Group
    attr_accessor :name

    def initialize(name, gem_dependencies, opts)
      @name = name
      @opts = opts
      @gems = gems_from_dependencies(gem_dependencies)
    end

    def print
      str = "\n"
      prepend_spacing = (@name == :default) ? '' : '  '
      if @name != :default
        str += "\ngroup #{@name.to_s.gsub(/[\[\]]/, '')} do\n"
      end
      str += @gems.map { |g| g.print(prepend_spacing) }.join("\n")
      str += "\nend\n" if @name != :default
      str
    end

    def gems_from_dependencies(gem_dependencies)
      gem_dependencies.map { |g| Rocktumbler::Gem.new(g, @opts) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rocktumbler-0.2.2 lib/rocktumbler/group.rb
rocktumbler-0.2.1 lib/rocktumbler/group.rb
rocktumbler-0.2.0 lib/rocktumbler/group.rb