Class: String

Inherits:
Object show all
Defined in:
lib/cucumber/core_ext/string.rb,
lib/cucumber/py_support/py_language.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#end_with?(str) ⇒ Boolean

1.9

Returns:

  • (Boolean)


78
79
80
81
82
# File 'lib/cucumber/py_support/py_language.rb', line 78

def end_with?(str) #:nodoc:
  str = str.to_str
  tail = self[-str.length, str.length]
  tail == str
end

#indent(n) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/cucumber/core_ext/string.rb', line 2

def indent(n)
  if n >= 0
    gsub(/^/, ' ' * n)
  else
    gsub(/^ {0,#{-n}}/, "")
  end
end