Class: VER::Text::Range
Constant Summary
Constants inherited from Struct
Instance Attribute Summary collapse
-
#buffer ⇒ Object
Returns the value of attribute buffer.
-
#first ⇒ Object
Returns the value of attribute first.
-
#last ⇒ Object
Returns the value of attribute last.
Instance Method Summary collapse
- #change ⇒ Object
- #copy ⇒ Object
- #count(*options) ⇒ Object
- #delete(*indices) ⇒ Object
- #dump(*options) ⇒ Object
- #encode_rot13!(record = buffer) ⇒ Object
- #get ⇒ Object
- #inspect ⇒ Object
- #kill ⇒ Object
- #lower_case!(record = buffer) ⇒ Object (also: #downcase!)
- #replace(*args) ⇒ Object
- #to_a ⇒ Object
- #toggle_case!(record = buffer) ⇒ Object
-
#upper_case!(record = buffer) ⇒ Object
(also: #upcase!)
alias needed?.
Methods inherited from Struct
Instance Attribute Details
#buffer ⇒ Object
Returns the value of attribute buffer
3 4 5 |
# File 'lib/ver/text/range.rb', line 3 def buffer @buffer end |
#first ⇒ Object
Returns the value of attribute first
3 4 5 |
# File 'lib/ver/text/range.rb', line 3 def first @first end |
#last ⇒ Object
Returns the value of attribute last
3 4 5 |
# File 'lib/ver/text/range.rb', line 3 def last @last end |
Instance Method Details
#change ⇒ Object
4 5 6 7 |
# File 'lib/ver/text/range.rb', line 4 def change kill buffer.minor_mode(:control, :insert) end |
#copy ⇒ Object
9 10 11 |
# File 'lib/ver/text/range.rb', line 9 def copy buffer.with_register{|reg| reg.value = get } end |
#count(*options) ⇒ Object
13 14 15 |
# File 'lib/ver/text/range.rb', line 13 def count(*) buffer.count(*self, *) end |
#delete(*indices) ⇒ Object
17 18 19 |
# File 'lib/ver/text/range.rb', line 17 def delete(*indices) buffer.delete(*self, *indices) end |
#dump(*options) ⇒ Object
21 22 23 |
# File 'lib/ver/text/range.rb', line 21 def dump(*) buffer.dump(*, *self) end |
#encode_rot13!(record = buffer) ⇒ Object
25 26 27 |
# File 'lib/ver/text/range.rb', line 25 def encode_rot13!(record = buffer) record.replace(*self, get.tr('A-Ma-mN-Zn-z', 'N-Zn-zA-Ma-m')) end |
#get ⇒ Object
33 34 35 |
# File 'lib/ver/text/range.rb', line 33 def get buffer.get(*self) end |
#inspect ⇒ Object
37 38 39 |
# File 'lib/ver/text/range.rb', line 37 def inspect "#<VER::Text::Range %s on %p>" % ["(#{first}..#{last})", buffer] end |
#kill ⇒ Object
41 42 43 44 |
# File 'lib/ver/text/range.rb', line 41 def kill copy delete end |
#lower_case!(record = buffer) ⇒ Object Also known as: downcase!
50 51 52 |
# File 'lib/ver/text/range.rb', line 50 def lower_case!(record = buffer) record.replace(*self, get.downcase) end |
#replace(*args) ⇒ Object
55 56 57 |
# File 'lib/ver/text/range.rb', line 55 def replace(*args) buffer.replace(first, last, *args) end |
#to_a ⇒ Object
59 60 61 |
# File 'lib/ver/text/range.rb', line 59 def to_a [first, last] end |
#toggle_case!(record = buffer) ⇒ Object
63 64 65 |
# File 'lib/ver/text/range.rb', line 63 def toggle_case!(record = buffer) record.replace(*self, get.tr('a-zA-Z', 'A-Za-z')) end |
#upper_case!(record = buffer) ⇒ Object Also known as: upcase!
alias needed?
68 69 70 |
# File 'lib/ver/text/range.rb', line 68 def upper_case!(record = buffer) record.replace(*self, get.upcase) end |