Class: Mirage::Template::Configuration

Inherits:
Object
  • Object
show all
Extended by:
Helpers::MethodBuilder
Defined in:
lib/mirage/client/template/configuration.rb

Constant Summary collapse

DEFAULT_HTTP_METHOD =
:get
DEFAULT_STATUS =
200
DEFAULT_DELAY =
0
DEFAULT_CONTENT_TYPE =
"text/plain"
DEFAULT_DEFAULT =
false

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::MethodBuilder

builder_methods

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



15
16
17
# File 'lib/mirage/client/template/configuration.rb', line 15

def initialize
  reset
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



28
29
30
# File 'lib/mirage/client/template/configuration.rb', line 28

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

Instance Attribute Details

#caller_bindingObject

Returns the value of attribute caller_binding.



8
9
10
# File 'lib/mirage/client/template/configuration.rb', line 8

def caller_binding
  @caller_binding
end

Instance Method Details

#==(config) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/mirage/client/template/configuration.rb', line 32

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

#resetObject



19
20
21
22
23
24
25
# File 'lib/mirage/client/template/configuration.rb', line 19

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