4337 links
  • Arnaud's links
  • Home
  • Login
  • RSS Feed
  • ATOM Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
page 1 / 1
1 results tagged arguments x
  • methods - How do functions use hash arguments in Ruby? - Stack Overflow

    L'appel d'une fonction peut se faire avec ou sans parenthèse :

    foo() ou foo

    Ensuite, un Hash peut avoir plusieurs formes..

    {'a' => 12}
    où 'a' peut être n'importe quoi : string (comme ici), mais aussi objet,
    symbol : exemple :
    {:a => 12}

    La nouvelle syntaxe, valable uniquement si les clés sont des symboles :

    {a: 12, b: 'toto'}

    Et enfin quand on call une méthode qui peut prendre un hash en argument (entre autre), pas besoin de mettre les { }

    foo({a: 12, b:14})
    ou
    foo(a: 12, b:14)
    ou
    foo a: 12, b:14

    August 10, 2015 at 2:36:17 PM GMT+2 - permalink - archive.org - http://stackoverflow.com/questions/16576477/how-do-functions-use-hash-arguments-in-ruby
    arguments hash named rails ruby syntax
Links per page: 20 50 100
page 1 / 1
Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Help/documentation