Class: Penchant::CustomProperty
- Inherits:
-
Object
- Object
- Penchant::CustomProperty
- Defined in:
- lib/penchant/custom_property.rb
Instance Method Summary collapse
-
#initialize(value) ⇒ CustomProperty
constructor
A new instance of CustomProperty.
- #process(values) ⇒ Object
Constructor Details
#initialize(value) ⇒ CustomProperty
Returns a new instance of CustomProperty.
3 4 5 |
# File 'lib/penchant/custom_property.rb', line 3 def initialize(value) @value = value end |
Instance Method Details
#process(values) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/penchant/custom_property.rb', line 7 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 |