Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/mcollective/monkey_patches.rb,
lib/mcollective/monkey_patches.rb

Overview

start_with? was introduced in 1.8.7, we need to support 1.8.5 and 1.8.6

Instance Method Summary collapse

Instance Method Details

#bytes(&block) ⇒ Object



68
69
70
71
72
73
# File 'lib/mcollective/monkey_patches.rb', line 68

def bytes(&block)
  # This should not be necessary, really ...
  return to_enum(:each_byte) unless block_given?

  each_byte(&block)
end

#start_with?(str) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/mcollective/monkey_patches.rb', line 5

def start_with?(str)
  self[0..(str.length - 1)] == str
end