Class: String

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

Instance Method Summary collapse

Instance Method Details

#end_with?(suffix) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/iron_worker_ng.rb', line 16

def end_with?(suffix)
  suffix = suffix.to_s
  self[-suffix.length, suffix.length] == suffix
end

#start_with?(prefix) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/iron_worker_ng.rb', line 11

def start_with?(prefix)
  prefix = prefix.to_s
  self[0, prefix.length] == prefix
end