Sha256: 2c5bd1c1f646676dc858b452a7b64b6d6234ad65ea39e8c9fe185ed99f33d9aa

Contents?: true

Size: 396 Bytes

Versions: 13

Compression:

Stored size: 396 Bytes

Contents

module ObjectAttorney

  module Helpers

    extend self

    def is_integer?(string)
      string.match(/^(\d)+$/)
    end

    def plural?(string)
      string = string.to_s
      string == string.pluralize
    end

    def try_or_return(object, method, default_value)
      returning_value = object.try(method)
      returning_value.nil? ? default_value : returning_value
    end

  end
  
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
object_attorney-2.2.10 lib/object_attorney/helpers.rb
object_attorney-2.2.9 lib/object_attorney/helpers.rb
object_attorney-2.2.8 lib/object_attorney/helpers.rb
object_attorney-2.2.7 lib/object_attorney/helpers.rb
object_attorney-2.2.6 lib/object_attorney/helpers.rb
object_attorney-2.2.5 lib/object_attorney/helpers.rb
object_attorney-2.2.4 lib/object_attorney/helpers.rb
object_attorney-2.2.3 lib/object_attorney/helpers.rb
object_attorney-2.2.2 lib/object_attorney/helpers.rb
object_attorney-2.2.1 lib/object_attorney/helpers.rb
object_attorney-2.1.3 lib/object_attorney/helpers.rb
object_attorney-2.1.2 lib/object_attorney/helpers.rb
object_attorney-2.1.1 lib/object_attorney/helpers.rb