Class: Squib::Args::CardRange Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/squib/args/card_range.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(input, deck_size: 1) ⇒ CardRange

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CardRange.



7
8
9
# File 'lib/squib/args/card_range.rb', line 7

def initialize(input, deck_size: 1)
  @range = validate(input, deck_size)
end

Instance Method Details

#each(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Hook into enumerable by delegating to @range



12
13
14
# File 'lib/squib/args/card_range.rb', line 12

def each(&block)
  @range.each { |i| block.call(i) }
end

#sizeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/squib/args/card_range.rb', line 16

def size
  @range.size
end