Sha256: 9191e34915edde3fddaddfb604825ac4be10422bd2d308c8b8b6472958e0c0cf

Contents?: true

Size: 834 Bytes

Versions: 1

Compression:

Stored size: 834 Bytes

Contents

module MiniCamel
  class RouteGenerator
    include Virtus.value_object

    attribute :env, Environment

    values do
      attribute :route_definition, Object
    end

    def generate_route
      raise InvalidRouteDefinition.new("Route #{route_definition.route_name}", route_definition) if route_definition.invalid?

      Route.new(route_name: route_definition.route_name, processors: generate_processors, env: env)
    end

    private

    def generate_processors
      processor_definitions.map do |processor_definition|
        raise InvalidProcessorDefinition.new("Invalid processor definition found", processor_definition) if processor_definition.invalid?

        processor_definition.generate_processor(env)
      end
    end

    def processor_definitions
      route_definition.processor_definitions
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mini_camel-0.5.8 lib/mini_camel/route_generator.rb