Module: CurlWrapper::ConfigOptions
- Included in:
- CurlWrapper
- Defined in:
- lib/curl_wrapper/config_options.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
4
5
6
7
8
9
10
11
12
|
# File 'lib/curl_wrapper/config_options.rb', line 4
def method_missing(method, *args, &block)
method = method.to_s
if method.length == 1
option = "-#{method}"
else
option = "--#{method.gsub('_', '-')}"
end
append_option option, args.first
end
|
Instance Method Details
#append_option(option, value = nil) ⇒ Object
18
19
20
21
22
23
24
25
26
|
# File 'lib/curl_wrapper/config_options.rb', line 18
def append_option option, value = nil
option = "#{option} '#{value}'" unless value.nil?
if @options.nil?
@options = option
else
@options = "#{@options} #{option}"
end
self
end
|
#fail ⇒ Object
28
29
30
|
# File 'lib/curl_wrapper/config_options.rb', line 28
def fail
append_option '--fail'
end
|
#http1_0 ⇒ Object
32
33
34
|
# File 'lib/curl_wrapper/config_options.rb', line 32
def http1_0
append_option '--http1.0'
end
|
#options ⇒ Object
14
15
16
|
# File 'lib/curl_wrapper/config_options.rb', line 14
def options
@options
end
|
#p ⇒ Object
40
41
42
|
# File 'lib/curl_wrapper/config_options.rb', line 40
def p
append_option '-p'
end
|
#proxy1_0(value) ⇒ Object
36
37
38
|
# File 'lib/curl_wrapper/config_options.rb', line 36
def proxy1_0 value
append_option '--proxy1.0', value
end
|
#verbose ⇒ Object
44
45
46
|
# File 'lib/curl_wrapper/config_options.rb', line 44
def verbose
append_option '--verbose'
end
|