Class: FakeUI::TextView

Inherits:
Object
  • Object
show all
Defined in:
lib/fakeui/text_view.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTextView

Returns a new instance of TextView.



5
6
7
8
9
# File 'lib/fakeui/text_view.rb', line 5

def initialize
  @string = ""
  @selectedRange = [0, 0]
  @textStorage = TextStorage.new
end

Instance Attribute Details

#selectedRangeObject

Returns the value of attribute selectedRange.



3
4
5
# File 'lib/fakeui/text_view.rb', line 3

def selectedRange
  @selectedRange
end

#stringObject

Returns the value of attribute string.



3
4
5
# File 'lib/fakeui/text_view.rb', line 3

def string
  @string
end

#textStorageObject

Returns the value of attribute textStorage.



3
4
5
# File 'lib/fakeui/text_view.rb', line 3

def textStorage
  @textStorage
end

Instance Method Details

#insertText(to_insert) ⇒ Object



16
17
18
19
# File 'lib/fakeui/text_view.rb', line 16

def insertText(to_insert)
  @string[@selectedRange[0], @selectedRange[1]] = to_insert
  @selectedRange = [@selectedRange[0] + to_insert.size, 0]
end

#scrollRangeToVisible(range) ⇒ Object



25
26
27
# File 'lib/fakeui/text_view.rb', line 25

def scrollRangeToVisible(range)
  # stub
end

#setDelegate(delegate) ⇒ Object



29
30
# File 'lib/fakeui/text_view.rb', line 29

def setDelegate(delegate)
end

#setSelectedRange(range) ⇒ Object



21
22
23
# File 'lib/fakeui/text_view.rb', line 21

def setSelectedRange(range)
  @selectedRange = range
end

#setString(string) ⇒ Object



11
12
13
14
# File 'lib/fakeui/text_view.rb', line 11

def setString(string)
  @string = string
  @selectedRange = [string.size, 0]
end