Module: Tk::Text::IndexModMethods
- Included in:
- IndexString, TkTextImage, TkTextMark, TkTextTag, TkTextWindow
- Defined in:
- lib/tk/text.rb
Instance Method Summary collapse
- #+(mod) ⇒ Object
- #-(mod) ⇒ Object
- #any_chars(mod) ⇒ Object (also: #any_char)
- #any_indices(mod) ⇒ Object
- #any_lines(mod) ⇒ Object (also: #any_line)
- #chars(mod) ⇒ Object (also: #char)
- #display_chars(mod) ⇒ Object (also: #display_char)
- #display_indices(mod) ⇒ Object
- #display_lineend ⇒ Object
- #display_lines(mod) ⇒ Object (also: #display_line)
- #display_linestart ⇒ Object
- #display_wordend ⇒ Object
- #display_wordstart ⇒ Object
- #indices(mod) ⇒ Object
- #lineend ⇒ Object
- #lines(mod) ⇒ Object (also: #line)
- #linestart ⇒ Object
- #wordend ⇒ Object
- #wordstart ⇒ Object
Instance Method Details
#+(mod) ⇒ Object
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/tk/text.rb', line 83 def +(mod) return chars(mod) if mod.kind_of?(Numeric) mod = mod.to_s if mod =~ /^\s*[+-]?\d/ Tk::Text::IndexString.new(String.new(id) << ' + ' << mod) else Tk::Text::IndexString.new(String.new(id) << ' ' << mod) end end |
#-(mod) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/tk/text.rb', line 94 def -(mod) return chars(-mod) if mod.kind_of?(Numeric) mod = mod.to_s if mod =~ /^\s*[+-]?\d/ Tk::Text::IndexString.new(String.new(id) << ' - ' << mod) elsif mod =~ /^\s*[-]\s+(\d.*)$/ Tk::Text::IndexString.new(String.new(id) << ' - -' << $1) else Tk::Text::IndexString.new(String.new(id) << ' ' << mod) end end |
#any_chars(mod) ⇒ Object Also known as: any_char
128 129 130 131 132 133 134 135 136 |
# File 'lib/tk/text.rb', line 128 def any_chars(mod) # Tk8.5 feature fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer) if mod < 0 Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any chars') else Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any chars') end end |
#any_indices(mod) ⇒ Object
159 160 161 162 163 164 165 166 167 |
# File 'lib/tk/text.rb', line 159 def any_indices(mod) # Tk8.5 feature fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer) if mod < 0 Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any indices') else Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any indices') end end |
#any_lines(mod) ⇒ Object Also known as: any_line
190 191 192 193 194 195 196 197 198 |
# File 'lib/tk/text.rb', line 190 def any_lines(mod) # Tk8.5 feature fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer) if mod < 0 Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' any_lines') else Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' any lines') end end |
#chars(mod) ⇒ Object Also known as: char
107 108 109 110 111 112 113 114 |
# File 'lib/tk/text.rb', line 107 def chars(mod) fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer) if mod < 0 Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' chars') else Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' chars') end end |
#display_chars(mod) ⇒ Object Also known as: display_char
117 118 119 120 121 122 123 124 125 |
# File 'lib/tk/text.rb', line 117 def display_chars(mod) # Tk8.5 feature fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer) if mod < 0 Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display chars') else Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display chars') end end |
#display_indices(mod) ⇒ Object
149 150 151 152 153 154 155 156 157 |
# File 'lib/tk/text.rb', line 149 def display_indices(mod) # Tk8.5 feature fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer) if mod < 0 Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display indices') else Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display indices') end end |
#display_lineend ⇒ Object
212 213 214 215 |
# File 'lib/tk/text.rb', line 212 def display_lineend # Tk8.5 feature Tk::Text::IndexString.new(String.new(id) << ' display lineend') end |
#display_lines(mod) ⇒ Object Also known as: display_line
179 180 181 182 183 184 185 186 187 |
# File 'lib/tk/text.rb', line 179 def display_lines(mod) # Tk8.5 feature fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer) if mod < 0 Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' display_lines') else Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' display lines') end end |
#display_linestart ⇒ Object
208 209 210 211 |
# File 'lib/tk/text.rb', line 208 def display_linestart # Tk8.5 feature Tk::Text::IndexString.new(String.new(id) << ' display linestart') end |
#display_wordend ⇒ Object
228 229 230 231 |
# File 'lib/tk/text.rb', line 228 def display_wordend # Tk8.5 feature Tk::Text::IndexString.new(String.new(id) << ' display wordend') end |
#display_wordstart ⇒ Object
224 225 226 227 |
# File 'lib/tk/text.rb', line 224 def display_wordstart # Tk8.5 feature Tk::Text::IndexString.new(String.new(id) << ' display wordstart') end |
#indices(mod) ⇒ Object
139 140 141 142 143 144 145 146 147 |
# File 'lib/tk/text.rb', line 139 def indices(mod) # Tk8.5 feature fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer) if mod < 0 Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' indices') else Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' indices') end end |
#lineend ⇒ Object
204 205 206 |
# File 'lib/tk/text.rb', line 204 def lineend Tk::Text::IndexString.new(String.new(id) << ' lineend') end |
#lines(mod) ⇒ Object Also known as: line
169 170 171 172 173 174 175 176 |
# File 'lib/tk/text.rb', line 169 def lines(mod) fail ArgumentError, 'expect Integer' unless mod.kind_of?(Integer) if mod < 0 Tk::Text::IndexString.new(String.new(id) << ' ' << mod.to_s << ' lines') else Tk::Text::IndexString.new(String.new(id) << ' + ' << mod.to_s << ' lines') end end |
#linestart ⇒ Object
201 202 203 |
# File 'lib/tk/text.rb', line 201 def linestart Tk::Text::IndexString.new(String.new(id) << ' linestart') end |
#wordend ⇒ Object
220 221 222 |
# File 'lib/tk/text.rb', line 220 def wordend Tk::Text::IndexString.new(String.new(id) << ' wordend') end |
#wordstart ⇒ Object
217 218 219 |
# File 'lib/tk/text.rb', line 217 def wordstart Tk::Text::IndexString.new(String.new(id) << ' wordstart') end |