Class: EmptyImmutableEnumerable

Inherits:
Object
  • Object
show all
Defined in:
lib/runtime/mixins.rb

Overview

The EmptyImmutableEnumerable class

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ EmptyImmutableEnumerable

Returns a new instance of EmptyImmutableEnumerable.



513
514
515
# File 'lib/runtime/mixins.rb', line 513

def initialize(klass)
  @subject = klass.new.freeze
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



521
522
523
524
525
526
# File 'lib/runtime/mixins.rb', line 521

def method_missing(method, *args, &block)
  return @subject.send(method, *args, &block) if @subject.respond_to?(method)
  super
rescue StandardError => _e
  args.first
end

Instance Method Details

#respond_to_missing?(method) ⇒ Boolean

Returns:

  • (Boolean)


517
518
519
# File 'lib/runtime/mixins.rb', line 517

def respond_to_missing?(method)
  @subject.respond_to?(method)
end