mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
copy editing AS guide [ci skip]
This commit is contained in:
parent
7663149f72
commit
2f0a5c7ac5
1 changed files with 4 additions and 19 deletions
|
@ -420,9 +420,9 @@ NOTE: Defined in `active_support/core_ext/object/with_options.rb`.
|
||||||
|
|
||||||
### JSON support
|
### JSON support
|
||||||
|
|
||||||
Active Support provides a better implemention of `to_json` than the json gem ordinarily provides for Ruby objects. This is because some classes, like Hash and OrderedHash, needs special handling in order to provide a proper JSON representation.
|
Active Support provides a better implemention of `to_json` than the +json+ gem ordinarily provides for Ruby objects. This is because some classes, like +Hash+ and +OrderedHash+ needs special handling in order to provide a proper JSON representation.
|
||||||
|
|
||||||
Active Support also provides an implementation of `as_json` for the Process::Status class.
|
Active Support also provides an implementation of `as_json` for the <tt>Process::Status</tt> class.
|
||||||
|
|
||||||
NOTE: Defined in `active_support/core_ext/object/to_json.rb`.
|
NOTE: Defined in `active_support/core_ext/object/to_json.rb`.
|
||||||
|
|
||||||
|
@ -447,23 +447,6 @@ C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
|
||||||
|
|
||||||
NOTE: Defined in `active_support/core_ext/object/instance_variables.rb`.
|
NOTE: Defined in `active_support/core_ext/object/instance_variables.rb`.
|
||||||
|
|
||||||
#### `instance_values`
|
|
||||||
|
|
||||||
The method `instance_values` returns a hash that maps instance variable names without "@" to their
|
|
||||||
corresponding values. Keys are strings:
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
class C
|
|
||||||
def initialize(x, y)
|
|
||||||
@x, @y = x, y
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
|
|
||||||
```
|
|
||||||
|
|
||||||
NOTE: Defined in `active_support/core_ext/object/instance_variables.rb`.
|
|
||||||
|
|
||||||
#### `instance_variable_names`
|
#### `instance_variable_names`
|
||||||
|
|
||||||
The method `instance_variable_names` returns an array. Each name includes the "@" sign.
|
The method `instance_variable_names` returns an array. Each name includes the "@" sign.
|
||||||
|
@ -2053,6 +2036,7 @@ NOTE: Defined in `active_support/core_ext/integer/inflections.rb`.
|
||||||
Extensions to `BigDecimal`
|
Extensions to `BigDecimal`
|
||||||
--------------------------
|
--------------------------
|
||||||
### `to_s`
|
### `to_s`
|
||||||
|
|
||||||
The method `to_s` is aliased to `to_formatted_s`. This provides a convenient way to display a BigDecimal value in floating-point notation:
|
The method `to_s` is aliased to `to_formatted_s`. This provides a convenient way to display a BigDecimal value in floating-point notation:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
@ -2060,6 +2044,7 @@ BigDecimal.new(5.00, 6).to_s # => "5.0"
|
||||||
```
|
```
|
||||||
|
|
||||||
### `to_formatted_s`
|
### `to_formatted_s`
|
||||||
|
|
||||||
Te method `to_formatted_s` provides a default specifier of "F". This means that a simple call to `to_formatted_s` or `to_s` will result in floating point representation instead of engineering notation:
|
Te method `to_formatted_s` provides a default specifier of "F". This means that a simple call to `to_formatted_s` or `to_s` will result in floating point representation instead of engineering notation:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
|
|
Loading…
Reference in a new issue