lib/wukong/processor.rb in wukong-3.0.1 vs lib/wukong/processor.rb in wukong-4.0.0
- old
+ new
@@ -11,46 +11,25 @@
#
# A Processor can be written and tested purely in Ruby and on your
# local machine. You can glue processors together
class Processor < Hanuman::Stage
include Logging
- include Vayacondios::Notifications
field :action, Whatever, :doc => false
class << self
def description desc=nil
@description = desc if desc
@description
end
-
- def consumes(*args)
- options = args.extract_options!
- @consumes = options[:as]
- validate_and_set_serialization(:from, args.first)
- end
-
- def produces(*args)
- options = args.extract_options!
- @produces = options[:as]
- validate_and_set_serialization(:to, args.first)
- end
- def valid_serializer? label
- label
- end
-
- def validate_and_set_serialization(direction, label)
- instance_variable_set("@serialization_#{direction}", label) if %w[ tsv json xml ].include?(label.to_s)
- end
-
def configure(settings)
settings.description = description if description
fields.each_pair do |name, field|
next if field.doc == false || field.doc.to_s == 'false'
- next if [:log, :notifier].include?(name)
+ next if [:log].include?(name)
field_props = {}.tap do |props|
props[:description] = field.doc unless field.doc == "#{name} field"
field_type = (field.type.respond_to?(:product) ? field.type.product : field.type)
configliere_type = case field_type
when String then nil
@@ -67,17 +46,9 @@
end
end
end
- def expected_record_type(type)
- self.class.instance_variable_get("@#{type}")
- end
-
- def expected_serialization(direction)
- self.class.instance_variable_get("@serialization_#{direction.to_s}")
- end
-
# When instantiated with a block, the block will replace this
# method.
#
# @param [Array<Object>] args
# @yield record a record that might be yielded by the block