Sha256: 0df10f4e2c0c4ff70390fda27251100dca7639ccfab125a015f5fefb8467cbff

Contents?: true

Size: 483 Bytes

Versions: 215

Compression:

Stored size: 483 Bytes

Contents

class Range
  RANGE_FORMATS = {
    :db => Proc.new { |start, stop| "BETWEEN '#{start.to_s(:db)}' AND '#{stop.to_s(:db)}'" }
  }

  # Gives a human readable format of the range.
  #
  # ==== Example
  #
  #   (1..100).to_formatted_s # => "1..100"
  def to_formatted_s(format = :default)
    if formatter = RANGE_FORMATS[format]
      formatter.call(first, last)
    else
      to_default_s
    end
  end

  alias_method :to_default_s, :to_s
  alias_method :to_s, :to_formatted_s
end

Version data entries

215 entries across 171 versions & 24 rubygems

Version Path
jquery_regex-0.0.3 vendor/bundle/gems/jquery_regex-0.0.2/vendor/bundle/gems/jquery_regex-0.0.1/vendor/bundle/gems/activesupport-3.2.9/lib/active_support/core_ext/range/conversions.rb
jquery_regex-0.0.3 vendor/bundle/gems/activesupport-3.2.9/lib/active_support/core_ext/range/conversions.rb
jquery_regex-0.0.3 vendor/bundle/gems/jquery_regex-0.0.3/vendor/bundle/gems/jquery_regex-0.0.2/vendor/bundle/gems/activesupport-3.2.9/lib/active_support/core_ext/range/conversions.rb
jquery_regex-0.0.3 vendor/bundle/gems/jquery_regex-0.0.3/vendor/bundle/gems/jquery_regex-0.0.2/vendor/bundle/gems/jquery_regex-0.0.1/vendor/bundle/gems/activesupport-3.2.9/lib/active_support/core_ext/range/conversions.rb
jquery_regex-0.0.3 vendor/bundle/gems/jquery_regex-0.0.1/vendor/bundle/gems/activesupport-3.2.9/lib/active_support/core_ext/range/conversions.rb
jquery_regex-0.0.3 vendor/bundle/gems/jquery_regex-0.0.3/vendor/bundle/gems/activesupport-3.2.9/lib/active_support/core_ext/range/conversions.rb
jquery_regex-0.0.3 vendor/bundle/gems/jquery_regex-0.0.3/vendor/bundle/gems/jquery_regex-0.0.1/vendor/bundle/gems/activesupport-3.2.9/lib/active_support/core_ext/range/conversions.rb
jquery_regex-0.0.1 vendor/bundle/gems/activesupport-3.2.9/lib/active_support/core_ext/range/conversions.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/activesupport-3.2.8/lib/active_support/core_ext/range/conversions.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/activesupport-3.2.9/lib/active_support/core_ext/range/conversions.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/activesupport-3.2.7/lib/active_support/core_ext/range/conversions.rb
challah-rolls-0.2.0 vendor/bundle/gems/activesupport-3.2.9/lib/active_support/core_ext/range/conversions.rb
challah-rolls-0.2.0 vendor/bundle/gems/activesupport-3.2.8/lib/active_support/core_ext/range/conversions.rb
challah-rolls-0.2.0 vendor/bundle/gems/activesupport-3.2.7/lib/active_support/core_ext/range/conversions.rb
challah-0.8.3 vendor/bundle/gems/activesupport-3.2.9/lib/active_support/core_ext/range/conversions.rb
challah-0.8.3 vendor/bundle/gems/activesupport-3.2.8/lib/active_support/core_ext/range/conversions.rb
classiccms-0.6.8 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/range/conversions.rb
activesupport-3.2.9 lib/active_support/core_ext/range/conversions.rb
activesupport-3.2.9.rc3 lib/active_support/core_ext/range/conversions.rb
classiccms-0.6.7 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/range/conversions.rb