Class: RBS::UnitTest::WithAliases::WithEnum
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Enumerable
|
|
Inherits: | Object |
Defined in: | lib/rbs/unit_test/with_aliases.rb |
Class Method Summary
- .new(enum) ⇒ WithEnum constructor
Instance Method Summary
Constructor Details
.new(enum) ⇒ WithEnum
# File 'lib/rbs/unit_test/with_aliases.rb', line 11
def initialize(enum) = @enum = enum
Instance Method Details
#and(*args, &block)
[ GitHub ]# File 'lib/rbs/unit_test/with_aliases.rb', line 27
def and(*args, &block) return WithEnum.new to_enum(__method__ || raise, *args) unless block each(&block) args.each do |arg| if WithEnum === arg # use `===` as `arg` might not have `.is_a?` on it arg.each(&block) else block.call(_ = arg) end end end
#and_nil(&block)
[ GitHub ]# File 'lib/rbs/unit_test/with_aliases.rb', line 15
def and_nil(&block) self.and(nil, &_ = block) end
#but(*cases, &block)
[ GitHub ]#each(&block)
[ GitHub ]# File 'lib/rbs/unit_test/with_aliases.rb', line 13
def each(&block) = @enum.each(&block)