Class: VER::Text::Index

Inherits:
Struct
  • Object
show all
Includes:
Position
Defined in:
lib/ver/text/index.rb

Constant Summary collapse

LINE =
/^\d+/
CHAR =
/\d+$/

Constants inherited from Struct

Struct::CACHE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Position

#+, #-, #<=>, #bbox, #change_line, #compare, #copy_line, #decrease_number, #delete, #delete_line, #delta, #dlineinfo, #dump, #formatted_binary, #formatted_exponential, #formatted_float, #formatted_hex, #formatted_number, #formatted_octal, #get, #increase_number, #insert, #kill_line, #lineend, #linestart, #see, #tag_names, #tags, #toggle_case!

Methods inherited from Struct

new

Instance Attribute Details

#bufferObject

Returns the value of attribute buffer

Returns:

  • (Object)

    the current value of buffer



3
4
5
# File 'lib/ver/text/index.rb', line 3

def buffer
  @buffer
end

#indexObject

Returns the value of attribute index

Returns:

  • (Object)

    the current value of index



3
4
5
# File 'lib/ver/text/index.rb', line 3

def index
  @index
end

Instance Method Details

#charObject



13
14
15
# File 'lib/ver/text/index.rb', line 13

def char
  index.to_s[CHAR].to_i
end

#inspectObject



30
31
32
# File 'lib/ver/text/index.rb', line 30

def inspect
  "#<VER::Text::Index %p on %p>" % [index, buffer]
end

#lineObject



9
10
11
# File 'lib/ver/text/index.rb', line 9

def line
  index.to_s[LINE].to_i
end

#to_aObject



25
26
27
28
# File 'lib/ver/text/index.rb', line 25

def to_a
  line, char = index.split('.')
  return line.to_i, char.to_i
end

#to_sObject



21
22
23
# File 'lib/ver/text/index.rb', line 21

def to_s
  index.to_s
end

#to_tclObject



17
18
19
# File 'lib/ver/text/index.rb', line 17

def to_tcl
  index
end