Sha256: e3de211ac4f34314494ad763ea7c8abf55ddf8702475c3aa6c91134cf295af51

Contents?: true

Size: 788 Bytes

Versions: 4

Compression:

Stored size: 788 Bytes

Contents

module Penchant
  class PropertyStack
    PATHING_OPTIONS = [ :git, :branch, :path ].freeze

    def initialize(builder, property_stack, strip_pathing_options)
      @builder, @property_stack, @strip_pathing_options = builder, property_stack.dup, strip_pathing_options
    end

    def processor
      @processor ||= PropertyStackProcessor.new(@builder)
    end

    def process_for_gem(gem_name, additional_env = {})
      properties = processor.process(gem_name, @property_stack)

      if @strip_pathing_options
        PATHING_OPTIONS.each { |key| properties.delete(key) }
      end

      properties = processor.process(gem_name, @builder.defaults[gem_name].merge(additional_env)).merge(properties)

      properties.delete(:opposite)

      Hash[properties.sort]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
penchant-0.2.29 lib/penchant/property_stack.rb
penchant-0.2.28 lib/penchant/property_stack.rb
penchant-0.2.27 lib/penchant/property_stack.rb
penchant-0.2.26 lib/penchant/property_stack.rb