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)


62
63
64
65
66
# File 'lib/cucumber/py_support/py_language.rb', line 62

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