Sha256: 86a89f3aff9bdc025529ab5fbaf50fbf0495618975776a89847376dd24e95f8a

Contents?: true

Size: 1.06 KB

Versions: 31

Compression:

Stored size: 1.06 KB

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

      def == config
        config.is_a?(Configuration) &&
            http_method == config.http_method &&
            status == config.status &&
            delay == config.delay &&
            content_type == config.content_type &&
            default == config.default

      end

    end
  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
mirage-3.0.4 lib/mirage/client/template/configuration.rb
mirage-3.0.3 lib/mirage/client/template/configuration.rb
mirage-3.0.2 lib/mirage/client/template/configuration.rb
mirage-3.0.1 lib/mirage/client/template/configuration.rb
mirage-3.0.0 lib/mirage/client/template/configuration.rb
mirage-3.0.0.alpha.17 lib/mirage/client/template/configuration.rb
mirage-3.0.0.alpha.16 lib/mirage/client/template/configuration.rb
mirage-3.0.0.alpha.15 lib/mirage/client/template/configuration.rb
mirage-3.0.0.alpha.14 lib/mirage/client/template/configuration.rb
mirage-3.0.0.alpha.13 lib/mirage/client/template/configuration.rb
mirage-3.0.0.alpha.12 lib/mirage/client/template/configuration.rb