Sha256: 4a5a7d02e518ab7637a6087968bb11d588912c0a4210dab5e34186affc9ac4cf

Contents?: true

Size: 483 Bytes

Versions: 96

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

96 entries across 96 versions & 4 rubygems

Version Path
social_url_stats-0.0.1 vendor/ruby/1.9.1/gems/activesupport-3.0.0/lib/active_support/core_ext/range/conversions.rb
activesupport-3.1.12 lib/active_support/core_ext/range/conversions.rb
activesupport-3.1.11 lib/active_support/core_ext/range/conversions.rb
activesupport-3.0.20 lib/active_support/core_ext/range/conversions.rb
activesupport-3.1.10 lib/active_support/core_ext/range/conversions.rb
activesupport-3.0.19 lib/active_support/core_ext/range/conversions.rb
activesupport-3.1.9 lib/active_support/core_ext/range/conversions.rb
activesupport-3.0.18 lib/active_support/core_ext/range/conversions.rb
dirty_history-0.7.3 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/range/conversions.rb
dirty_history-0.7.2 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/range/conversions.rb
dirty_history-0.7.1 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/range/conversions.rb
dirty_history-0.7.0 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/range/conversions.rb
dirty_history-0.6.7 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/range/conversions.rb
dirty_history-0.6.6 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/range/conversions.rb
dirty_history-0.6.5 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/range/conversions.rb
dirty_history-0.6.4 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/range/conversions.rb
activesupport-3.1.8 lib/active_support/core_ext/range/conversions.rb
activesupport-3.0.17 lib/active_support/core_ext/range/conversions.rb
dirty_history-0.6.3 dirty_history/ruby/1.9.1/gems/activesupport-3.1.1/lib/active_support/core_ext/range/conversions.rb
activesupport-3.1.7 lib/active_support/core_ext/range/conversions.rb