Skip to content

Instantly share code, notes, and snippets.

@Nakilon Nakilon/news.md
Last active May 6, 2018

Embed
What would you like to do?
Changes in Ruby versions that are the most important for me (comments https://www.reddit.com/r/ruby/comments/8233et/so_ive_updated_my_macos_and_now_switching_from/)

N -- new feature -- I may consider using it
B -- breaking change -- I should review my code

https://github.com/ruby/ruby/blob/ruby_2_1/NEWS

N def-expr now returns the symbol of its name instead of nil.
N Array#to_h converts an array of key-value pairs into a Hash.
N Enumerable#to_h converts a list of key-value pairs into a Hash.
N Binding#local_variable_get(symbol)
N Exception#cause provides the previous exception which has been caught at where raising the new exception.
N Fixnum#bit_length
N Fixnum#bit_length
N Numeric#step allows the limit argument to be omitted, in which case an infinite sequence of numbers is generated. Keyword arguments `to` and `by` are introduced for ease of use.
N Process.argv0() returns the original value of $0.
N String#scrub and String#scrub! verify and fix invalid byte sequence.
B Hash#reject will return plain Hash object in the future versions, that is the original object's subclass, instance variables, default value, and taintedness will be no longer copied, so now warnings are emitted when called with such Hash.
B Now Module#define_method and Object#define_singleton_method return the symbols of the defined methods, not the methods/procs themselves.
B Returning from lambda proc now always exits from the Proc, not from the method where the lambda is created. 
B If invalid: :replace is specified for String#encode, replace invalid byte sequence even if the destination encoding equals to the source encoding.
B URI.decode_www_form follows current WHATWG URL Standard. It gets encoding argument to specify the character encoding. It now allows loose percent encoded strings, but denies ;-separator.

https://github.com/ruby/ruby/blob/ruby_2_2/NEWS

N Symbol key followed by a colon can be quoted.
N Enumerable#slice_after
N Enumerable#slice_when
N min, min_by, max and max_by supports optional argument to return multiple elements.
N Kernel#itself
B { **hash1, **hash2 } contains values of hash2 for duplicated keys.
B Math.log now raises Math::DomainError instead of returning NaN if the base is less than 0, and returns NaN instead of -infinity if both of two arguments are 0.
B Math.atan2 now returns values like as expected by C99 if both two arguments are infinity.
B ArgumentError is no longer raised when lambda Proc is passed as a block, and the number of yielded arguments does not match the formal arguments of the lambda, if just an array is yielded and its length matches.
B callcc is obsolete. use Fiber instead.
B Digest::HMAC has been removed. Example edit: https://github.com/mailgun/mailgun-ruby/pull/16/files
B support RFC 3986. https://bugs.ruby-lang.org/issues/2542
B Prime.prime? now returns false for negative numbers.

https://github.com/ruby/ruby/blob/ruby_2_3/NEWS

N new method call syntax, `object&.foo', method #foo is called on `object' if it is not nil
N new string literal, here document starts with `<<~`
N Array#bsearch_index
N Array#dig, Hash#dig, Struct#dig
N Enumerable#grep_v and Enumerator::Lazy#grep_v is added as inverse version of #grep.
N Enumerable#chunk_while
N File.mkfifo
N Hash#fetch_values
N Hash#<=, Hash#<, Hash#>=, Hash#>
N Hash#to_proc
N Numeric#positive? and Numeric#negative?
N String#+@ and String#-@ are added to get mutable/frozen strings.
N Array#inspect, Hash#inspect doesn't raise error even if its content returns a string which is not compatible with Encoding.default_external as inspected result.
N Logger#level= now supports symbol and string levels such as :debug, :info, :warn, :error, :fatal (case insensitive) 
B Array#select!, Array#keep_if, Array#reject!, and Array#delete_if no longer changes the receiver array instantly every time the block is called.
B Array#flatten and Array#flatten! no longer try to call #to_ary method on elements beyond the given level.
B Enumerable#chunk and Enumerable#slice_before no longer takes the initial_state argument. Use a local variable instead to maintain a state.
B IO#close doesn't raise when the IO object is closed.
B default value of Net::HTTP#open_timeout is now 60 (was nil).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.