Class: Penchant::PropertyStack

Inherits:
Object
  • Object
show all
Defined in:
lib/penchant/property_stack.rb

Constant Summary collapse

PATHING_OPTIONS =
[ :git, :branch, :path ].freeze

Instance Method Summary collapse

Constructor Details

#initialize(builder, property_stack, strip_pathing_options) ⇒ PropertyStack

Returns a new instance of PropertyStack.



5
6
7
# File 'lib/penchant/property_stack.rb', line 5

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

Instance Method Details

#process_for_gem(gem_name, additional_env = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/penchant/property_stack.rb', line 13

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

#processorObject



9
10
11
# File 'lib/penchant/property_stack.rb', line 9

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