Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/lib/util.rb,
lib/ui/protjes.rb

Instance Method Summary collapse

Instance Method Details

#ends_with?(str) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/lib/util.rb', line 19

def ends_with?(str)
  self.rindex( str ) == self.length - str.length
end

#from_cObject



27
28
29
# File 'lib/lib/util.rb', line 27

def from_c
  self.to_f.from_c
end

#smaller(l = 75) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/lib/util.rb', line 31

def smaller(l=75)
  if self.size > l
    self[0..l] + "..."
else
  self
  end
end

#starts_with?(str) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/lib/util.rb', line 15

def starts_with?(str)
  self.index( str ) == 0
end

#to_booleanObject



39
40
41
42
# File 'lib/lib/util.rb', line 39

def to_boolean
  return true if (self == "t" or self.to_i != 0)
  false
end

#to_cObject



23
24
25
# File 'lib/lib/util.rb', line 23

def to_c
  self.to_f.to_c
end