Class: String

Inherits:
Object show all
Defined in:
lib/string__.rb,
lib/string__.rb

Instance Method Summary collapse

Instance Method Details

#add_periodObject



72
73
74
75
76
77
# File 'lib/string__.rb', line 72

def add_period
  if self[-1] == '.'
    self
  else
    "#{self}."; end
end

#ends_with?(a) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/string__.rb', line 68

def ends_with?(a)
  end_with? a
end

#in?(a) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/string__.rb', line 64

def in?(a)
  a.include? self
end


59
60
61
62
# File 'lib/string__.rb', line 59

def print
  Kernel.print self
  self
end

#putsObject



54
55
56
57
# File 'lib/string__.rb', line 54

def puts
  Kernel.puts self
  self
end

#uppercaseObject



96
97
98
99
100
# File 'lib/string__.rb', line 96

def uppercase
  return '' if self[0].nil?

  self[0].capitalize + slice(1, length)
end