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 7957177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:12:36+00:00 2026-06-04T04:12:36+00:00

comics = load_comics( ‘/comics.txt’ ) Popup.make do h1 Comics on the Web list do

  • 0
comics = load_comics( '/comics.txt' )

Popup.make do
  h1 "Comics on the Web"
  list do
    comics.each do |name, url|
      link name, url
    end
  end
end

I am new to ruby. This is a piece of code from a ruby website.

I cant find what ‘link’ and ‘list’ keyword in the menu.
can someone explain it a little bit those two keywords, and where is the definition of those two keyword .

I am also confused on how they read the variables name and url, they are reading it by the space at the same line or what?
so if I have
Comics1 link_of_comics_site_1
Comics2 link_of_comics_site_2
Comics3 link_of_comics_site_3

so for the first iteration, name=Comics1, and url =link_of_comics_site_1

Thanks.

  • 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-06-04T04:12:37+00:00Added an answer on June 4, 2026 at 4:12 am

    That’s not just Ruby. That’s a template for a webpage using ruby add-on methods for HTML generation.

    But presumably, the result of the call to load_comics is a Hash, where the keys are names and the values are URLs. You could make one of those yourself:

    my_comics_hash = { "name1" => "url1", "name2" => "url2" }
    

    which you can then iterate over the same way:

    my_comics_hash.each do |name, url|
      puts "Name #{name} goes with URL #{url}"
    end
    

    In your code, it’s building up an HTML list inside a popup window, but it’s the same idea. The each method iterates over a collection – in this case a Hash – and runs some code on every item in that collection – in this case, each key/value pair. When you call each, you pass it a block of code inside do … end; that’s the code that gets run on each item. The current item is passed to the code block, which declares a variable to hold it inside the pipes right after the word do. Since we’re iterating over key/value pairs, we can declare two variables, and the key goes in the first and the value in the second.

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

Sidebar

Related Questions

var array = new Array(); $.get('comics.txt', function(data) { array = data.split(,); for(var i =
def load_­comics(pat­h) comics={} File.forea­ch(path) do |line­| name, url = line.­split(': ') comics[nam­e] = url.s­trip
I am writting a script that checks a folder K:/Comics and inserts each name
I'm building a website which will show comics. I'd like to store each image
So I'm trying to make an incrementer similar to this: http://www.usagain.com/ but I'm apparently
I am trying to write a java program that will automatically download and name
I am new to iphone application development. I am building an iphone app where
So here's the situation: I have a friend who wants me to make an
I have this kind of Html list: lista = <ul> <li>Arts &amp; Entertainment <ul>
I have a list of this kind: lista = <ul> <li>Arts &amp; Entertainment <ul>

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.