1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge branch 'master' of github.com:lifo/docrails

This commit is contained in:
Vijay Dev 2012-01-21 21:26:10 +05:30
commit 2d000328df
3 changed files with 24 additions and 21 deletions

View file

@ -258,6 +258,7 @@ module ActionView
# * <tt>:delimiter</tt> - Sets the thousands delimiter (defaults to "").
# * <tt>:strip_insignificant_zeros</tt> - If +true+ removes insignificant zeros after the decimal separator
# (defaults to +false+).
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when the argument is invalid.
#
# ==== Examples
# number_with_precision(111.2345) # => 111.235
@ -328,6 +329,7 @@ module ActionView
# * <tt>:delimiter</tt> - Sets the thousands delimiter (defaults to "").
# * <tt>:strip_insignificant_zeros</tt> - If +true+ removes insignificant zeros after the decimal separator (defaults to +true+)
# * <tt>:prefix</tt> - If +:si+ formats the number using the SI prefix (defaults to :binary)
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when the argument is invalid.
# ==== Examples
# number_to_human_size(123) # => 123 Bytes
# number_to_human_size(1234) # => 1.21 KB
@ -401,6 +403,7 @@ module ActionView
# * *integers*: <tt>:unit</tt>, <tt>:ten</tt>, <tt>:hundred</tt>, <tt>:thousand</tt>, <tt>:million</tt>, <tt>:billion</tt>, <tt>:trillion</tt>, <tt>:quadrillion</tt>
# * *fractionals*: <tt>:deci</tt>, <tt>:centi</tt>, <tt>:mili</tt>, <tt>:micro</tt>, <tt>:nano</tt>, <tt>:pico</tt>, <tt>:femto</tt>
# * <tt>:format</tt> - Sets the format of the output string (defaults to "%n %u"). The field types are:
# * <tt>:raise</tt> - If true, raises +InvalidNumberError+ when the argument is invalid.
#
# %u The quantifier (ex.: 'thousand')
# %n The number

View file

@ -81,25 +81,25 @@ class Module
# no matter whether +nil+ responds to the delegated method. You can get a
# +nil+ instead with the +:allow_nil+ option.
#
# class Foo
# attr_accessor :bar
# def initialize(bar = nil)
# @bar = bar
# end
# delegate :zoo, :to => :bar
# end
# class Foo
# attr_accessor :bar
# def initialize(bar = nil)
# @bar = bar
# end
# delegate :zoo, :to => :bar
# end
#
# Foo.new.zoo # raises NoMethodError exception (you called nil.zoo)
# Foo.new.zoo # raises NoMethodError exception (you called nil.zoo)
#
# class Foo
# attr_accessor :bar
# def initialize(bar = nil)
# @bar = bar
# end
# delegate :zoo, :to => :bar, :allow_nil => true
# end
# class Foo
# attr_accessor :bar
# def initialize(bar = nil)
# @bar = bar
# end
# delegate :zoo, :to => :bar, :allow_nil => true
# end
#
# Foo.new.zoo # returns nil
# Foo.new.zoo # returns nil
#
def delegate(*methods)
options = methods.pop

View file

@ -3,12 +3,12 @@ require 'logger'
require 'active_support/logger'
module ActiveSupport
# Wraps any standard Logger class to provide tagging capabilities. Examples:
# Wraps any standard Logger object to provide tagging capabilities. Examples:
#
# Logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
# Logger.tagged("BCX") { Logger.info "Stuff" } # Logs "[BCX] Stuff"
# Logger.tagged("BCX", "Jason") { Logger.info "Stuff" } # Logs "[BCX] [Jason] Stuff"
# Logger.tagged("BCX") { Logger.tagged("Jason") { Logger.info "Stuff" } } # Logs "[BCX] [Jason] Stuff"
# logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
# logger.tagged("BCX") { logger.info "Stuff" } # Logs "[BCX] Stuff"
# logger.tagged("BCX", "Jason") { logger.info "Stuff" } # Logs "[BCX] [Jason] Stuff"
# logger.tagged("BCX") { logger.tagged("Jason") { logger.info "Stuff" } } # Logs "[BCX] [Jason] Stuff"
#
# This is used by the default Rails.logger as configured by Railties to make it easy to stamp log lines
# with subdomains, request ids, and anything else to aid debugging of multi-user production applications.