Sha256: c2e001e03569c4407048c31bd2a7aaf83875ef9bf023187a8c8d947fab801ac2
Contents?: true
Size: 831 Bytes
Versions: 9
Compression:
Stored size: 831 Bytes
Contents
module Watir class Util class << self # @example # Watir::Util.demodulize("Watir::Span") # => "Span" def demodulize(str) str.gsub(/^.*::/, '') end # @example # Watir::Util.underscore("FooBar") # => "foo_bar" def underscore(str) str.gsub(/\B[A-Z][^A-Z]/, '_\&').downcase.gsub(' ', '_') end # @example # Watir::Util.singularize("Checkboxes") # => "Checkbox" # Watir::Util.singularize("Bodies") # => "Body" # Watir::Util.singularize("Buttons") # => "Button" def singularize(str) case str.downcase when "checkboxes" str.chop.chop when "bodies" str.chop.chop.chop + "y" else str.chop end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems