Issue #10130 has been updated by Tsuyoshi Sawada.


What about using a sequence of space characters as delimiter?

    h = {
      author: {
        name: "Ruby Taro",
        affiliation: "Ruby co.",
      },
      date: "2014, 8, 14"
    }

    "Author: %{author name} (%{author affiliation}), %{date}" % h
    #=> "Author: Ruby Taro (Ruby co.), 2014, 8, 14"

    "%{author name} works at %{author affiliation}" % h
    #=> "Ruby Taro works at Ruby co."

This is reminiscent of (and hence consistent with) `%w{}` and `%i{}` notations, which also use a sequence of space characters as delimiter.

----------------------------------------
Feature #10130: String format with nested hash
https://bugs.ruby-lang.org/issues/10130#change-55698

* Author: Tsuyoshi Sawada
* Status: Rejected
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
When we do string format with hashes, we have the restriction that the hash cannot be a nested one. When we want to handle more complicated string formats, for example in templates, it is more convenient if we can use a nested hash.

    "Author: %{author.name} (%{author.affiliation}), %{date}" % {author: {name: "Ruby Taro", affiliation: "Ruby co."}, date: "2014, 8, 14"}
    #=> "Author: Ruby Taro (Ruby co.), 2014, 8, 14"



-- 
https://bugs.ruby-lang.org/