Method: HTTPX::Options.def_option
- Defined in:
- lib/httpx/options.rb
.def_option(name, &interpreter) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/httpx/options.rb', line 27 def def_option(name, &interpreter) << name.to_sym interpreter ||= ->(v) { v } attr_accessor name protected :"#{name}=" define_method(:"with_#{name}") do |value| other = dup other.send(:"#{name}=", other.instance_exec(value, &interpreter)) other end end |