Class: Canopus::Selection
- Inherits:
-
Data
- Object
- Data
- Canopus::Selection
- Defined in:
- lib/canopus/selection.rb,
sig/canopus.rbs
Instance Attribute Summary collapse
-
#anchor ⇒ Object
readonly
Returns the value of attribute anchor.
-
#goal ⇒ Object
readonly
Returns the value of attribute goal.
-
#head ⇒ Object
readonly
Returns the value of attribute head.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#anchor ⇒ Object (readonly)
Returns the value of attribute anchor
4 5 6 |
# File 'lib/canopus/selection.rb', line 4 def anchor @anchor end |
#goal ⇒ Object (readonly)
Returns the value of attribute goal
4 5 6 |
# File 'lib/canopus/selection.rb', line 4 def goal @goal end |
#head ⇒ Object (readonly)
Returns the value of attribute head
4 5 6 |
# File 'lib/canopus/selection.rb', line 4 def head @head end |
#id ⇒ Object (readonly)
Returns the value of attribute id
4 5 6 |
# File 'lib/canopus/selection.rb', line 4 def id @id end |
Class Method Details
.new ⇒ instance
23 |
# File 'sig/canopus.rbs', line 23
def self.new: (Integer id, Integer anchor, Integer head, Integer? goal) -> instance
|
Instance Method Details
#empty? ⇒ Boolean
8 |
# File 'lib/canopus/selection.rb', line 8 def empty? = anchor == head |
#end ⇒ Integer
6 |
# File 'lib/canopus/selection.rb', line 6 def end = [anchor, head].max |
#range ⇒ Range[Integer]
7 |
# File 'lib/canopus/selection.rb', line 7 def range = self.start...self.end |
#reversed? ⇒ Boolean
9 |
# File 'lib/canopus/selection.rb', line 9 def reversed? = head < anchor |
#start ⇒ Integer
5 |
# File 'lib/canopus/selection.rb', line 5 def start = [anchor, head].min |