|
|
||||||
|
#1
|
|
|
|
|
Hi all!
I have a class that is used in a Webby page. The class needs to make use of a function within three modules: -------------------------------------------- module Webby module Helpers #:nodoc: module UrlHelper -------------------------------------------- Since the function is an "instance" function, I need to include the modules like so: -------------------------------------------- class Categoriser include Webby::Helpers::UrlHelper -------------------------------------------- Later in my class I have (bear with me): -------------------------------------------- def render .. html << %[<li> #{link_to_page(:title => r.title)} </li>] -------------------------------------------- link_to_page (within the three modules) looks like this: -------------------------------------------- def link_to_page( *args ) self.link_to(*_find_page(args)) end -------------------------------------------- And gives me: NoMethodError Exception: undefined method `find' for nil:NilClass I can't find any reference to this usage of the asterisk, and I don't know what the *_find_page does. Can anyone explain it to me? Les |
|
|
|
#2
|
|
|
|
|
On Feb 18, 2008 9:46 PM, Leslie Viljoen <leslieviljoen> wrote:
[..] > def link_to_page( *args ) > self.link_to(*_find_page(args)) > end > -------------------------------------------- > > And gives me: > NoMethodError Exception: undefined method `find' for nil:NilClass > > I can't find any reference to this usage of the asterisk, and > I don't know what the *_find_page does. Can anyone explain it to me? It's called the 'splat' operator. see e.g. http://theplana.wordpress.com/2007/0...plat-operator/ [url down] http://ola-bini.blogspot.com/2006/11...s-of-ruby.html |
|
#3
|
|
|
|
|
Thanks! I now know splats!
|
|
|
| Similar Threads | |
| Thread | Thread Starter |
| Some quastions about Webby Hello. I want to build my oown simple application based on Webby for making prototypes of web-sies. I plan to use my custom CSS Framework and HAML. How I can change... |
Anton Komarov |
| webby, ubuntu and gems I've recently switched distributions to ubuntu, and I'm having problems getting webby up and running. (I suspect this a general problem with gems that need to install... |
Martin DeMello |
| [ANN] Webby 0.7.2 == Webby by Tim Pease [..] == Description Webby builds websites. It's not a framework. It's not a webserver. It's not a content management system. Webby builds websites... |
Tim Pease |
| Webby, Gems and Paths I am running an Ubuntu box, and it seems that whenever I "gem install" something with an executable (eg. /var/lib/gems/1.8/gems/webby-0.7.2/bin/webby) - I have to make a link... |
Leslie Viljoen |
| Upgrade From Asterisk-1.2 To Asterisk-1.4 Via Ports All, The Asterisk project had just recently released asterisk-1.4 with some new features. However, as of FreeBSD-6.2, the FreeBSD ports still uses asterisk 1.2 and it is in... |
Demuel I. Bendano, EE |
|
Privacy Policy | All times are GMT. The time now is 12:18 AM.
|
|
|