Class: PositionalGenerator::Builder::Oneof::OneofSelector
- Inherits:
-
Object
- Object
- PositionalGenerator::Builder::Oneof::OneofSelector
show all
- Defined in:
- lib/helpers/positional_generator.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of OneofSelector.
382
383
384
385
|
# File 'lib/helpers/positional_generator.rb', line 382
def initialize(builder)
@subgens = []
@builder = Builder.new(builder.as_type)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, **kwargs, &block) ⇒ Object
387
388
389
|
# File 'lib/helpers/positional_generator.rb', line 387
def method_missing(meth, *args, **kwargs, &block)
@subgens << [meth, args, kwargs, block]
end
|
Instance Method Details
#generate ⇒ Object
400
401
402
|
# File 'lib/helpers/positional_generator.rb', line 400
def generate(...)
@builder.build
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
391
392
393
|
# File 'lib/helpers/positional_generator.rb', line 391
def respond_to_missing?(method_name, include_private = false)
@builder.respond_to?(method_name, include_private)
end
|
#sample ⇒ Object
395
396
397
398
|
# File 'lib/helpers/positional_generator.rb', line 395
def sample
(meth, args, kwargs, block) = Faker::Base.sample(@subgens)
@builder.send(meth, *args, **kwargs, &block)
end
|