Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6997685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:18:53+00:00 2026-05-27T20:18:53+00:00

I declare steps that need to be done in order to install wordpress in

  • 0

I declare steps that need to be done in order to install wordpress in an array in the beginning of my ruby script

$wordpress_cmds = [ "mkdir -p #{$web_root}#{$web_directory}#{$web_url}/public_html",
                    "cp -R #{$wordpress_current}/*  #{$web_root}#{$web_directory}#{$web_url}/public_html",
                    "chown -R www-data:www-data #{$web_root}#{$web_directory}#{$web_url}",
                 ]

Some of the variables are updated later on. Is there any way to get the latest values of all variables that are in the array when accessing the arrya?

Let’s say that if my code is like I always get the initial value of the array not the one I want (with updated variables inside)

$web_root = '====='
$wordpress_cmds = ["#{$web_root}"]

puts $wordpress_cmds[0]
$web_root= "new value"
puts $wordpress_cmds[0] 
$web_root.replace("new value")
puts $wordpress_cmds[0]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:18:53+00:00Added an answer on May 27, 2026 at 8:18 pm

    No, string interpolation is one-time operation. It modifies the string by substituting values and that’s it. However, with a slightly modified code you can do like this:

    $web_root = '====='
    $wordpress_cmds = [lambda{"mkdir -p #{$web_root}#{$web_directory}#{$web_url}/public_html"}]
    
    puts $wordpress_cmds[0].call
    $web_root= "new value"
    puts $wordpress_cmds[0].call 
    $web_root.replace("new value")
    puts $wordpress_cmds[0].call
    

    Output:

    =====
    new value
    new value
    

    Here instead of string you put a function into array. That function will return an actual value of your variable. So, you have to do $wordpress_cmds[0].call instead of $wordpress_cmds[0] to actually invoke it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help with the following code that requires me to: Declare 3 double
I need some help. Right now i have done a file search that will
I declare a static char array, then I pass it to a function. How
I need to have a class with one activity that is performed once per
I have two date fields that I need to join on. The first is
I am developing an auto-builder that will run a series of steps in our
So in Sql Server it appears that I cannot have specific steps within my
Declare @BadDecimal varchar(5) Set @BadDecimal = '4.5' Declare @GoodDecimal Decimal Set @GoodDecimal = @BadDecimal
DECLARE @table table(XYZ VARCHAR(8) , id int) INSERT INTO @table SELECT '4000', 1 UNION
Declare: LPWSTR** lines= new LPWSTR*[totalLines]; then i set using: lines[totalLines]=&totalText; SetWindowText(totalChat,(LPWSTR)lines[totalLines]); totalLines++; Now I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.