Class: Mindtrick::Text

Inherits:
String
  • Object
show all
Defined in:
lib/mindtrick/text.rb

Instance Method Summary collapse

Instance Method Details

#each_fragmentObject



3
4
5
6
7
8
# File 'lib/mindtrick/text.rb', line 3

def each_fragment
  return to_enum(:each_fragment) unless block_given?
  (0..term.length).each do |i|
    yield self.class.new(term[0...i])
  end
end

#prefixed(prefix) ⇒ Object



14
15
16
# File 'lib/mindtrick/text.rb', line 14

def prefixed(prefix)
  "#{ prefix }:#{ downcase }"
end

#termObject



10
11
12
# File 'lib/mindtrick/text.rb', line 10

def term
  strip.gsub(/\s+/,' ')
end