Class: Input::TextValue

Inherits:
Object
  • Object
show all
Defined in:
mygame/lib/sprite_kit/vendor/input.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ TextValue

Returns a new instance of TextValue.



115
116
117
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 115

def initialize(text)
  @text = text
end

Instance Attribute Details

#text ⇒ Object (readonly)

Returns the value of attribute text.



113
114
115
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 113

def text
  @text
end

Instance Method Details

#empty? ⇒ Boolean

Returns:

  • (Boolean)


127
128
129
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 127

def empty?
  @text.empty?
end

#index(text) ⇒ Object



135
136
137
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 135

def index(text)
  @text.index(text)
end

#insert(from, to, text) ⇒ Object



131
132
133
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 131

def insert(from, to, text)
  @text = @text[0, from].to_s + text + @text[to, @text.length].to_s
end

#length ⇒ Object



123
124
125
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 123

def length
  @text.length
end

#replace(text) ⇒ Object



148
149
150
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 148

def replace(text)
  @text = text
end

#rindex(text) ⇒ Object



139
140
141
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 139

def rindex(text)
  @text.rindex(text)
end

#slice(from, length = 1) ⇒ Object Also known as: []



143
144
145
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 143

def slice(from, length = 1)
  @text.slice(from, length)
end

#to_s ⇒ Object



119
120
121
# File 'mygame/lib/sprite_kit/vendor/input.rb', line 119

def to_s
  @text
end