Sha256: 298837131edc92ea9b4eb9504d019ef4ba4521a8e113218250cf8cf17c810980

Contents?: true

Size: 312 Bytes

Versions: 5

Compression:

Stored size: 312 Bytes

Contents

# frozen_string_literal: true

class String
  # see if string is numeric
  def is_number?
    begin
      true if Float(self)
    rescue # rubocop:disable Style/RescueStandardError
      false
    end
  end

  def trim
    trimmed = strip

    if trimmed.nil?
      self
    else
      trimmed
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yawast-0.7.2 lib/string_ext.rb
yawast-0.7.1 lib/string_ext.rb
yawast-0.7.0 lib/string_ext.rb
yawast-0.7.0.beta3 lib/string_ext.rb
yawast-0.7.0.beta2 lib/string_ext.rb