Class: String

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

Overview

:nodoc:

Direct Known Subclasses

Cucumber::Ast::DocString

Instance Method Summary collapse

Instance Method Details

#end_with?(str) ⇒ Boolean

1.9

Returns:

  • (Boolean)


74
75
76
77
78
# File 'lib/cucumber/py_support/py_language.rb', line 74

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