Sha256: 05b32885ed5bdf8a99e7336679f83e573759e954db811c386df92dd6f842da29

Contents?: true

Size: 359 Bytes

Versions: 4

Compression:

Stored size: 359 Bytes

Contents

module Penchant
  class CustomProperty
    def initialize(value)
      @value = value
    end

    def process(values)
      if @value.respond_to?(:call)
        @value.call(*values).to_a
      else
        @value.collect do |k, v|
          v = v.dup.gsub(%r{\$(\d+)}) { |m| values[m.to_i - 1 ] }

          [ k, v ]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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