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
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/core_ext/range/conversions.rb
activesupport-3.2.22.5 lib/active_support/core_ext/range/conversions.rb
activesupport-3.2.22.4 lib/active_support/core_ext/range/conversions.rb
activesupport-3.2.22.3 lib/active_support/core_ext/range/conversions.rb
activesupport-3.2.22.2 lib/active_support/core_ext/range/conversions.rb
activesupport-3.2.22.1 lib/active_support/core_ext/range/conversions.rb
classiccms-0.7.5 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/range/conversions.rb
classiccms-0.7.4 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/range/conversions.rb
classiccms-0.7.3 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/core_ext/range/conversions.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/core_ext/range/conversions.rb
activesupport-3.2.22 lib/active_support/core_ext/range/conversions.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.12/lib/active_support/core_ext/range/conversions.rb
activesupport-3.2.21 lib/active_support/core_ext/range/conversions.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/core_ext/range/conversions.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/activesupport-3.2.18/lib/active_support/core_ext/range/conversions.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/core_ext/range/conversions.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/activesupport-3.2.18/lib/active_support/core_ext/range/conversions.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.18/lib/active_support/core_ext/range/conversions.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.18/lib/active_support/core_ext/range/conversions.rb
activesupport-3.2.20 lib/active_support/core_ext/range/conversions.rb