Sha256: a0a821789c46feab5f263cac8adad85d201fbc3f65f9e210b17259e240a57f80

Contents?: true

Size: 815 Bytes

Versions: 8

Compression:

Stored size: 815 Bytes

Contents

module Soybean
  module Generators
    class MiddlewareGenerator
      include BaseGenerator

      attr_reader :name, :model

      delegate :wsdl, :to => :model
      delegate :class_name, :interface_name, :to => :model, :prefix => true

      def initialize(model)
        @model = model
        @name = (wsdl.name.name.underscore.gsub(/service$/, '') rescue 'base') + 'middleware'
      end

      def dir
        'middlewares'
      end

      def generate
        source = File.expand_path("../templates/middleware.rb", __FILE__)
        context = instance_eval('binding')
        content = ERB.new(::File.binread(source), nil, '-').result(context)
        content
      end

      def class_name
        @name.camelize
      end

      def endpoint_path
        model_class_name
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
soybean-2.4.3 lib/soybean/generators/middleware_generator.rb
soybean-2.4.2 lib/soybean/generators/middleware_generator.rb
soybean-2.4.1 lib/soybean/generators/middleware_generator.rb
soybean-2.4.0 lib/soybean/generators/middleware_generator.rb
soybean-2.3.0 lib/soybean/generators/middleware_generator.rb
soybean-2.2.2 lib/soybean/generators/middleware_generator.rb
soybean-2.2.1 lib/soybean/generators/middleware_generator.rb
soybean-2.2.0 lib/soybean/generators/middleware_generator.rb