Sha256: b727f36402c7efb33ca1b8066665f78510a74a7265eaf9efd943b89c7208cce0

Contents?: true

Size: 799 Bytes

Versions: 2

Compression:

Stored size: 799 Bytes

Contents

require 'client/helpers/method_builder'

module Mirage
  class Template
    class Configuration
      extend Helpers::MethodBuilder
      builder_methods :http_method, :status, :delay, :content_type, :default
      attr_accessor :caller_binding
      DEFAULT_HTTP_METHOD=:get
      DEFAULT_STATUS=200
      DEFAULT_DELAY=0
      DEFAULT_CONTENT_TYPE="text/plain"
      DEFAULT_DEFAULT=false

      def initialize
        reset
      end

      def reset
        @http_method = DEFAULT_HTTP_METHOD
        @status = DEFAULT_STATUS
        @delay = DEFAULT_DELAY
        @content_type = DEFAULT_CONTENT_TYPE
        @default = DEFAULT_DEFAULT
      end


      def method_missing(method, *args, &block)
        @caller_binding.send method, *args, &block if @caller_binding
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mirage-3.0.0.alpha.11 lib/mirage/client/template/configuration.rb
mirage-3.0.0.alpha.10 lib/mirage/client/template/configuration.rb