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-4.0.0.alpha10 lib/mirage/client/template/configuration.rb
mirage-4.0.0.alpha9 lib/mirage/client/template/configuration.rb
mirage-4.0.0.alpha8 lib/mirage/client/template/configuration.rb
mirage-4.0.0.alpha6 lib/mirage/client/template/configuration.rb
mirage-4.0.0.alpha5 lib/mirage/client/template/configuration.rb
mirage-4.0.0.alpha4 lib/mirage/client/template/configuration.rb
mirage-4.0.0.alpha3 lib/mirage/client/template/configuration.rb
mirage-4.0.0.alpha2 lib/mirage/client/template/configuration.rb
mirage-4.0.0.alpha1 lib/mirage/client/template/configuration.rb
mirage-3.0.14 lib/mirage/client/template/configuration.rb
mirage-3.0.13 lib/mirage/client/template/configuration.rb
mirage-3.0.12 lib/mirage/client/template/configuration.rb
mirage-3.0.11 lib/mirage/client/template/configuration.rb
mirage-3.0.10 lib/mirage/client/template/configuration.rb
mirage-3.0.9 lib/mirage/client/template/configuration.rb
mirage-on-thin-3.0.8 lib/mirage/client/template/configuration.rb
mirage-3.0.8 lib/mirage/client/template/configuration.rb
mirage-3.0.7 lib/mirage/client/template/configuration.rb
mirage-3.0.6 lib/mirage/client/template/configuration.rb
mirage-3.0.5 lib/mirage/client/template/configuration.rb