Deprecation warning


#1

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-search/google-desktop/download.html]

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


#2

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 M. removed_email_address@domain.invalid:

“keyword”=>“file-search”}

Ml mailing list
removed_email_address@domain.invalid
http://lists.ruby-it.org/mailman/listinfo/ml


Carlo P.
email: removed_email_address@domain.invalid
twitter: @carlopecchia


#3

…Grazie mille!!!