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

  • Home
  • SEARCH
  • 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 6617111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:39:55+00:00 2026-05-25T20:39:55+00:00

@hash is a global hash that looks something like: @hash = { xmlns:xsi =>http://www.w3.org/2001/XMLSchema-instance,

  • 0

@hash is a global hash that looks something like:

@hash = {
   "xmlns:xsi"    =>"http://www.w3.org/2001/XMLSchema-instance", 
   "xsi:noNamespaceSchemaLocation"=>"merchandiser.xsd", 
   "header"       =>[{"merchantId"=>["35701"], 
   "merchantName" =>["Lingerie.com"], 
   "createdOn"    =>["2011-09-23/00:33:35"]}], 
   "trailer"      =>[{"numberOfProducts"=>["0"]}]
}

And I would expect this to work if I call the method below like:

def amethod
    hash_value("header", "merchantName") // returns "Lingerie.com"
end

def hash_value *attributes, hash = nil
    hash = @hash unless hash
    att = attributes.delete_at.first
    attributes.empty? ? hash[att].first : hash_value(attributes, hash[att].first)
end
  • 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-25T20:39:56+00:00Added an answer on May 25, 2026 at 8:39 pm

    You can’t have a default argument after a splat arg. Instead, require that the attribute list be passed as an array, like so:

    def hash_value(attributes, hash = @hash)
      return hash if attributes.empty?
      hash_value(attributes[1..-1], hash[attributes.first].first)
    end
    
    p hash_value(["header", "merchantName"])         # => "Lingerie.com"
    p hash_value(["trailer", "numberOfProducts"])    # => "0"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is my configuration file: <?xml version=1.0 encoding=UTF-8?> <infinispan xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=urn:infinispan:config:4.2 http://www.infinispan.org/schemas/infinispan-config-4.2.xsd xmlns=urn:infinispan:config:4.2> <global>
I want to create a Config class that acts somewhere between a hash and
Here's my function: function process_image($path) { global $mysqli; list($width,$height) = getimagesize($path); $hash = md5_file($path,true);
I'm working on something that involved using the Bit.ly API, and allow the user
So, I am about 99% certain that I have implemented something wrong, but heres
I have a global var that is updated later on in my program, and
I'm considering using the hash method to create static urls to content that is
Consider the following XML: <response> <status_code>200</status_code> <status_txt>OK</status_txt> <data> <url>http://bit.ly/b47LVi</url> <hash>b47LVi</hash> <global_hash>9EJa3m</global_hash> <long_url>http://www.tumblr.com/docs/en/api#api_write</long_url> <new_hash>0</new_hash> </data>
SHA Hash functions
Evidently hash keys are compared in a case-sensitive manner. $ perl -e '%hash =

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.