Class: Faraday::Builder
- Inherits:
-
Object
- Object
- Faraday::Builder
- Defined in:
- lib/leadlight/lib_ext/faraday/builder.rb
Defined Under Namespace
Classes: Handler
Instance Method Summary collapse
- #adapter(key = nil, *args, &block) ⇒ Object
- #adapter=(adapter_args) ⇒ Object
- #build(options = {}) {|_self| ... } ⇒ Object
- #clear ⇒ Object
- #clear_adapters ⇒ Object
- #find_adapter ⇒ Object
- #has_adapter? ⇒ Boolean
Instance Method Details
#adapter(key = nil, *args, &block) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/leadlight/lib_ext/faraday/builder.rb', line 22 def adapter(key=nil, *args, &block) if [key, *args, block].none? find_adapter else use_symbol(Faraday::Adapter, key, *args, &block) end end |
#adapter=(adapter_args) ⇒ Object
34 35 36 37 |
# File 'lib/leadlight/lib_ext/faraday/builder.rb', line 34 def adapter=(adapter_args) clear_adapters adapter(*adapter_args) end |
#build(options = {}) {|_self| ... } ⇒ Object
12 13 14 15 16 |
# File 'lib/leadlight/lib_ext/faraday/builder.rb', line 12 def build( = {}) raise_if_locked clear unless [:keep] yield self if block_given? end |
#clear ⇒ Object
18 19 20 |
# File 'lib/leadlight/lib_ext/faraday/builder.rb', line 18 def clear @handlers.clear end |
#clear_adapters ⇒ Object
43 44 45 |
# File 'lib/leadlight/lib_ext/faraday/builder.rb', line 43 def clear_adapters @handlers.delete_if{|h| h.adapter?} end |
#find_adapter ⇒ Object
39 40 41 |
# File 'lib/leadlight/lib_ext/faraday/builder.rb', line 39 def find_adapter @handlers.detect{|h| h.adapter?} end |
#has_adapter? ⇒ Boolean
30 31 32 |
# File 'lib/leadlight/lib_ext/faraday/builder.rb', line 30 def has_adapter? !!find_adapter end |