Class: RestEasy::Resource::ConfigureDSL
- Inherits:
- BasicObject
- Defined in:
- lib/rest_easy/resource.rb
Overview
── Configure DSL proxy ─────────────────────────────────────────────Evaluates a block in a context where bare method calls map to config setters: ‘adapter :grpc` → config.adapter = :grpc No-arg calls read, so nested access works naturally:
`database.dsn = "sqlite:memory"` → config.database is returned,
then .dsn= is called on the nested config directly.
Instance Method Summary collapse
-
#initialize(config) ⇒ ConfigureDSL
constructor
A new instance of ConfigureDSL.
- #method_missing(name, *args) ⇒ Object
Constructor Details
#initialize(config) ⇒ ConfigureDSL
Returns a new instance of ConfigureDSL.
48 49 50 |
# File 'lib/rest_easy/resource.rb', line 48 def initialize(config) @config = config end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/rest_easy/resource.rb', line 52 def method_missing(name, *args) if args.empty? @config.__send__(name) else @config.__send__(:"#{name}=", args.length == 1 ? args.first : args) end end |