Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/lib/util.rb,
lib/ui/protjes.rb
Instance Method Summary collapse
- #ends_with?(str) ⇒ Boolean
- #from_c ⇒ Object
- #smaller(l = 75) ⇒ Object
- #starts_with?(str) ⇒ Boolean
- #to_boolean ⇒ Object
- #to_c ⇒ Object
Instance Method Details
#ends_with?(str) ⇒ Boolean
19 20 21 |
# File 'lib/lib/util.rb', line 19 def ends_with?(str) self.rindex( str ) == self.length - str.length end |
#from_c ⇒ Object
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
15 16 17 |
# File 'lib/lib/util.rb', line 15 def starts_with?(str) self.index( str ) == 0 end |
#to_boolean ⇒ Object
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_c ⇒ Object
23 24 25 |
# File 'lib/lib/util.rb', line 23 def to_c self.to_f.to_c end |