Forum: Italian Ruby user group Deprecation warning

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
598fadf49a8e63645edfb36cba7dc1c9?d=identicon&s=25 Luigi Maresca (luigi-s-w-net)
on 2009-05-22 07:48
Salve ragazzi,
come da voi suggerito sto cominciando a dare un occhiata al
development.log.

Ho riscontrato questo DEPRECATION WARNING:

Processing ViewController#scarica (for 79.51.42.228 at 2009-05-04
17:04:19) [GET]
  Session ID: dd34c9a8d401cbb213b681c0c9a46d42
  Parameters: {"title"=>"google-desktop", "id"=>"213",
"keyword"=>"file-search"}
Rendering template within layouts/down_guida
Rendering view/scarica
DEPRECATION WARNING: truncate takes an option hash instead of separate
length and omission arguments. (called from
_run_rhtml_app47views47view47scarica46rhtml at
/home/softwav4/it/app/views/view/scarica.rhtml:21)
Completed in 279ms (View: 85, DB: 171) | 200 OK
[http://www.software-windows.net/213/software/file-...]

il warning penso si riferisca all'esecuzione di:

temp=truncate(strip_tags(@pages.text),200)
@description="#{temp.split[0..19].join(" ")}..."

mi sapete dire perché?

Grazie

Luigi
7ec76fde95878f95d7ae2e23cd99533e?d=identicon&s=25 Carlo Pecchia (cpecchia)
on 2009-05-22 08:37
(Received via mailing list)
Molte API stanno passando da una "logica" di passaggio di parametri a
lista piatta ad un hash.
In effetti è più facile ricordare la chiave dell'hash che non la
posizione in una flat list (IMHO)...

Nel caso di truncate, riprendendo dalla documentazione:

truncate("Once upon a time in a world far far away")
  # => Once upon a time in a world f...

  truncate("Once upon a time in a world far far away", :length => 14)
  # => Once upon a...

  truncate("And they found that many people were sleeping better.",
:length => 25, "(clipped)")
  # => And they found that many (clipped)

  truncate("And they found that many people were sleeping better.",
:omission => "... (continued)", :length => 15)
  # => And they found... (continued)

Quindi dovresti utilizzare:

  temp = truncate(strip_tags(@pages.text), :length => 200)


2009/5/22 Luigi Maresca <marluigi@libero.it>:
> "keyword"=>"file-search"}
>
> Ml mailing list
> Ml@lists.ruby-it.org
> http://lists.ruby-it.org/mailman/listinfo/ml
>



--
Carlo Pecchia
email: c.pecchia@gmail.com
twitter: @carlopecchia
598fadf49a8e63645edfb36cba7dc1c9?d=identicon&s=25 Luigi Maresca (luigi-s-w-net)
on 2009-05-23 04:39
...Grazie mille!!!
This topic is locked and can not be replied to.