sonic-pi

https://github.com/sonic-pi-net/sonic-pi

C++

Code. Music. Live.

ActiveSupport::TimeWithZone#as_json

Coerces time to a string for JSON encoding. The default format is ISO 8601.
You can get %Y/%m/%d %H:%M:%S +offset style by setting
<tt>ActiveSupport::JSON::Encoding.use_standard_json_time_format</tt>
to +false+.

  # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = true
  Time.utc(2005,2,1,15,15,10).in_time_zone("Hawaii").to_json
  # => "2005-02-01T05:15:10.000-10:00"

  # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = false
  Time.utc(2005,2,1,15,15,10).in_time_zone("Hawaii").to_json
  # => "2005/02/01 05:15:10 -1000"

Source | Google | Stack overflow

Edit

git clone [email protected]:sonic-pi-net/sonic-pi.git

cd sonic-pi

open app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/time_with_zone.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-ActiveSupport--TimeWithZone-as_json-for-pr


# Commit to git

git add app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/time_with_zone.rbgit commit -m "better docs for ActiveSupport::TimeWithZone#as_json"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-ActiveSupport--TimeWithZone-as_json-for-pr

hub pull-request


# Celebrate!