Sha256: 0ebfe5b66f1c270bad400556c3fdadca13bf7252825cf52cb1d79de7b4d7f1b3

Contents?: true

Size: 367 Bytes

Versions: 5

Compression:

Stored size: 367 Bytes

Contents

# Extensions for ruby classes

class Array

  # Holds the total number of pagination results
  attr_accessor :total

end

class String

  # Adding a to_bool method
  def to_bool
    return true if self =~ (/^(true|yes|t|y|[1-9]+)$/i)
    return false if self.empty? || self =~ (/^(false|no|n|f|0)$/i)

    raise ArgumentError.new %{invalid value: #{self}}
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mongocore-0.2.1 lib/mongocore/ext.rb
mongocore-0.2.0 lib/mongocore/ext.rb
mongocore-0.1.10 lib/mongocore/ext.rb
mongocore-0.1.9 lib/mongocore/ext.rb
mongocore-0.1.8 lib/mongocore/ext.rb