Class: Ifilter::Input

Inherits:
Object
  • Object
show all
Defined in:
lib/ifilter/input.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text = '') ⇒ Input

Returns a new instance of Input.



5
6
7
# File 'lib/ifilter/input.rb', line 5

def initialize(text = '')
  @text = text
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



3
4
5
# File 'lib/ifilter/input.rb', line 3

def text
  @text
end

Instance Method Details

#<<(text) ⇒ Object



9
10
11
# File 'lib/ifilter/input.rb', line 9

def <<(text)
  @text << text
end

#backspace!Object



13
14
15
# File 'lib/ifilter/input.rb', line 13

def backspace!
  @text.chop!
end

#to_regexObject



21
22
23
24
25
# File 'lib/ifilter/input.rb', line 21

def to_regex
  /#{@text}/i
rescue
  nil
end

#to_sObject



17
18
19
# File 'lib/ifilter/input.rb', line 17

def to_s
  @text
end