Ruby question about # Signs

前端 未结 2 1199
隐瞒了意图╮
隐瞒了意图╮ 2021-01-17 05:53

As seen here: http://railstutorial.org/chapters/rails-flavored-ruby#top for the file:

app/helpers/application_helper.rb:

module ApplicationHelper

           


        
相关标签:
2条回答
  • 2021-01-17 06:28

    It's called string interpolation. base_title is a variable, and the #{} characters denote that its value should be substituted in place of that marker.

    0 讨论(0)
  • 2021-01-17 06:34

    It's string interpolation. Eg:

    name = "nobosh"
    puts "Hello, #{name}."
    

    Prints

    Hello, nobosh.

    0 讨论(0)
提交回复
热议问题