diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2016-06-26 10:43:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-26 10:43:38 +0800 |
commit | f4c0dfb8263aeb77c1db2ac3753a58ac5412baef (patch) | |
tree | 5db267ae5ae4e6c94aececf6c7bca0d923cce04b /activesupport/lib/active_support | |
parent | d66adf12ba0a32528f3b517f8ead7321f53c0cc5 (diff) | |
parent | abbf00e5830141d3eda451e10bf12c3dccf668ec (diff) | |
download | rails-f4c0dfb8263aeb77c1db2ac3753a58ac5412baef.tar.gz rails-f4c0dfb8263aeb77c1db2ac3753a58ac5412baef.tar.bz2 rails-f4c0dfb8263aeb77c1db2ac3753a58ac5412baef.zip |
Merge pull request #25526 from tricknotes/pathname-as-json
Define `Pathname#as_json`
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/json.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/json.rb b/activesupport/lib/active_support/core_ext/object/json.rb index 32a41eafe4..363bde5a68 100644 --- a/activesupport/lib/active_support/core_ext/object/json.rb +++ b/activesupport/lib/active_support/core_ext/object/json.rb @@ -2,6 +2,7 @@ require 'json' require 'bigdecimal' require 'uri/generic' +require 'pathname' require 'active_support/core_ext/big_decimal/conversions' # for #to_s require 'active_support/core_ext/hash/except' require 'active_support/core_ext/hash/slice' @@ -199,6 +200,12 @@ class URI::Generic #:nodoc: end end +class Pathname #:nodoc: + def as_json(options = nil) + to_s + end +end + class Process::Status #:nodoc: def as_json(options = nil) { :exitstatus => exitstatus, :pid => pid } |