Sha256: 89605464a1ea0dec44a9dc088dbb1a7511be8224af451fbc00622deba09e5022

Contents?: true

Size: 547 Bytes

Versions: 4

Compression:

Stored size: 547 Bytes

Contents

module Penchant
  class PropertyStackProcessor
    def initialize(builder)
      @builder = builder
    end

    def process(gem_name, stack)
      properties = {}
      property_stack = stack.dup.to_a

      while !property_stack.empty?
        key, value = property_stack.shift

        if property = @builder[key]
          property_stack += property.process([ value ].flatten)
        else
          value = value % gem_name if value.respond_to?(:%)

          properties[key] = value
        end
      end

      properties
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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