Module: Relax2::DSL

Included in:
Base
Defined in:
lib/relax2/dsl.rb

Instance Method Summary collapse

Instance Method Details

#base_url(base_url_value) ⇒ Object

Parameters:

  • base_url_value (String)


6
7
8
# File 'lib/relax2/dsl.rb', line 6

def base_url(base_url_value)
  @base_url = base_url_value
end

#interceptor(interceptor_impl = nil, &interceptor_impl_block) ⇒ Object

Parameters:

  • interceptor_impl (Proc|Symbol) (defaults to: nil)


11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/relax2/dsl.rb', line 11

def interceptor(interceptor_impl = nil, &interceptor_impl_block)
  impl =
    if interceptor_impl_block
      interceptor_impl_block
    elsif interceptor_impl.is_a?(Symbol)
      ::Relax2::Interceptors.send(interceptor_impl)
    elsif interceptor_impl.respond_to?(:call)
      interceptor_impl
    else
      raise ArgumentError, 'interceptor must be specified as Proc or block'
    end
  (@interceptors ||= []) << impl
end