Trying to find a reference to the manual but can't [closed] - ruby

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Simple question, what is the best way on windows to search the documentation. This time I was wanting information on 'while'(resolved now by google) but I still can't can't get ri or the chm documentation on windows to give a result to while.
If I type in the Keyword in search in the chm it doesn't return 'while' it returns many results but not 'while' same for index search.
so In installed ri.
>rdoc --all --ri
but if I search while
C:\Ruby193\bin>ri 'while'
Nothing known about .while
I would like to read from the official results. Whats the best?
Also tried ri interactive but same result.
C:\Documents and Settings\renshaw>ri -i
Enter the method name you want to look up.
You can use tab to autocomplete.
Enter a blank line to exit.
>> while
Nothing known about .while
>>

That's because ri gives you information about methods, and not language syntax. while is Ruby's keyword, just like begin. If you try you won't find anything about begin in ri. Instead you can try ri File::read for example.

For Ruby core language keywords and topics, use the ruby: prefix.
If you ran ri ruby:while, you would get a list of pages. In that list is syntax/control_expressions.rdoc, which probably contains the information that you want.
ri ruby:control_expressions
Gives you the documentation for core Ruby control expressions (which includes while).

Related

What does 'splat dollar less' (*$<) mean? [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I've seen magic variables like this used in Ruby. $_ $' $0
Is there a complete reference for what all of them mean and how they are set?
Their name is global variables. There are several different references.
You can get a full list by calling the method Kernel#global_variables
puts global_variables
Ruby also includes a file called "English.rb" in the standard library which provides an in-depth explanation of several global variables.
Also, there's (an archived version of) "Cryptic Ruby Global Variables and Their Meanings".
Finally, the Ruby Programming wikibook has a "Predefined Variables" reference.
They are called "global variables" (complete list at the bottom of the page): http://www.rubyist.net/~slagell/ruby/globalvars.html
The Ruby documentation used to be very class orientated. In recent versions of Ruby however there are rdoc files about literals, precedence, syntax, globals and much more.

Easiest Way to Find XPath Of An Element [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I am learning Scrapy and wondering is there some existing tool - probably Chrome Maybe Web Developer or Firefox plug-in to quickly get the XPath of a web element. Or the best way to go is learn Xpath and build the Xpath yourself from scratch.
For Chrome...
There are plugins such as XPath Helper that can produce an XPath to a given element on an HTML page. You can also right-click on an element in a page and pull up its position in the Elements tab. From there, you can right-click and select Copy XPath.
And to really learn XPath, I'd recommend directly writing your own from scratch. You can select nodes directly from the console by using $x(). For example, here's how to select the search form on this page:
> $x("//form[#id='search']")
[<form id=​"search" action=​"/​search" method=​"get" autocomplete=​"on">​…​</form>​]
Note that the form element will be expandable interactively in the console.
Here's how to select all of the text nodes on this page that contain the word Thanks:
> $x("//text()[contains(.,'Thanks')]")
["Thanks a lot!", "Thanks for contributing an answer to Stack Overflow!"]
Note that you'll get more matches than I originally did if you try it on this page. Strange loop.
Here's how to select the number of votes this answer has received:
> $x("//div[#id='answer-18839594']//span[#class='vote-count-post ']/text()")
["0"]
Note an unfortunate robustness issue where vote-count-post must include a trailing space to mirror the current source. Note also the unfortunately low value returned by that XPath. ;-)
There is no such thing as "the XPath of an element". There are a variety of paths you might be interested in. The shortest machine-executable path is probably along the lines *[3]/*[1]/*[2]. The most readable path is something like chap[3]/section[1]/para[2]; but this may be dependent on the namespace context. For a context-free path you might want *[local-name()='chap' and namespace-uri()='...'][1]/*[local-name()='section' and namespace-uri()='...'][3]. But sometimes when people ask for "the path", they just want chap/section/para, that is, a path that selects many elements including the target element. But for some purposes, the most usable XPath expression might be id('Intro').

How can I index my source code? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Are there any tools out there that will index source code, client side, and provide blazing fast search results?
How can I index our internal source code? is related but covers server side tools.
Everything and Locate32 are nice indexing-tools on the windows platform. Just one problem, they only index the file-names.
DocFetcher is another solution, it tries to index the content of the files, but have big memory issues as it cannot index the content of bigger files, and just skips them
I'm also on the search for something to index my data, and i want some tool like locate32 wich is supernice to integrate with the windows shell, but it would be nice to get it to index the content of files also, only brute word indexing, no magic to be done to the data, but let me do plain wildcard searches, like words starting with, ending with, and containing.
But the search is still on.. (for an app, that is..)
Install ctags.
Then ctags -R in the root of your source tree. Many editors, including Vim, can use the resulting tags file to give near-instant search results.
I know this is an old question, but maybe this will help someone else.
Take a look at CodeIDX: http://sourceforge.net/projects/codeidx/.
Using CodeIDX you can index multiple directories using filetype filters and search the created index.
You can open multiple searches at the same time and the results can be viewed in a preview.
Using GNU Global you can get browsable, searchable source code. You can run this locally too or use all the tools that go with it (like less to go straight to a function definition).
See http://www.tamacom.com/tour/kernel/linux/ for an example of the Linux Kernel.

What are the magic $-prefixed variables in Ruby? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I've seen magic variables like this used in Ruby. $_ $' $0
Is there a complete reference for what all of them mean and how they are set?
Their name is global variables. There are several different references.
You can get a full list by calling the method Kernel#global_variables
puts global_variables
Ruby also includes a file called "English.rb" in the standard library which provides an in-depth explanation of several global variables.
Also, there's (an archived version of) "Cryptic Ruby Global Variables and Their Meanings".
Finally, the Ruby Programming wikibook has a "Predefined Variables" reference.
They are called "global variables" (complete list at the bottom of the page): http://www.rubyist.net/~slagell/ruby/globalvars.html
The Ruby documentation used to be very class orientated. In recent versions of Ruby however there are rdoc files about literals, precedence, syntax, globals and much more.

How do I add existing comments to RDoc in Ruby? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I want to format my existing comments as 'RDoc comments' so they can be viewed using ri.
What are some recommended resources for starting out using RDoc?
A few things that have bitten me:
:main: -- RDoc uses only the last one evaluated; best to make sure there's only one in your project and you don't also use the --main command-line argument.
same as previous, but for :title:
:section: doesn't work very well
RDoc uses SimpleMarkup so it's fairly simple to create lists, etc. using *, - or a number. It also treats lines that are indented at the same column number as part of the same paragraph until there is an empty line which signifies a new paragraph. Do you have a few examples of comments you want RDoc'ed so we could show you how to do them and then you could extrapolate that for the rest of your comments?

Resources