Class: Canopus::BlockSelection

Inherits:
Data
  • Object
show all
Includes:
Enumerable, Enumerable[[DisplayPoint,
Defined in:
lib/canopus/selection.rb,
sig/canopus.rbs

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#anchor ⇒ Object (readonly)

Returns the value of attribute anchor

Returns:

  • (Object) —

    the current value of anchor



12
13
14
# File 'lib/canopus/selection.rb', line 12

def anchor
  @anchor
end

#head ⇒ Object (readonly)

Returns the value of attribute head

Returns:

  • (Object) —

    the current value of head



12
13
14
# File 'lib/canopus/selection.rb', line 12

def head
  @head
end

Class Method Details

.new ⇒ instance

Parameters:

Returns:

  • (instance)


35
# File 'sig/canopus.rbs', line 35

def self.new: (DisplayPoint anchor, DisplayPoint head) -> instance

Instance Method Details

#each ⇒ self #each ⇒ Enumerator[[DisplayPoint, DisplayPoint], self]

Overloads:

Yields:

Yield Parameters:

Yield Returns:

  • (void)


15
16
17
18
19
20
21
# File 'lib/canopus/selection.rb', line 15

def each
  return enum_for(__method__) unless block_given?
  first, last = [anchor.row, head.row].minmax
  first.upto(last) do |row|
    yield DisplayPoint.new(row, anchor.column), DisplayPoint.new(row, head.column)
  end
end