Sha256: cbd0873d643b1a0cc43779ffa6bda7c369a68d9965a9b3a0e75435e5c1b0dadd
Contents?: true
Size: 632 Bytes
Versions: 1
Compression:
Stored size: 632 Bytes
Contents
module MiniCamel module Processor class ExposeField < Base values do attribute :field, Symbol attribute :from, Symbol attribute :as, Symbol end def call(exchange) from_value = exchange.context_fetch(from) if from_value.is_a?(Hash) field_value = from_value[field] else if !from_value.respond_to?(field) raise ArgumentError, "#{from} does not respond to #{field}" end field_value = from_value.public_send(field) end exchange.update_context(as => field_value) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mini_camel-0.5.8 | lib/mini_camel/processor/expose_field.rb |