What are the magic $-prefixed variables in Ruby? [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
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.

Related

Document methods in a ruby c extension [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 2 years ago.
Improve this question
I've been working on some ruby libraries with C extensions now. And I want to give users access to the irb#help method, e.g:
> help("Array#empty?")
# Prints documentation for the method.
I've been using the same way to name functions as ruby core, and the same documentation pattern. However, irb always tell me that there is Nothing known about FastPolyline.decode.
Here's my method:
/*
* call-seq:
* FastPolylines.decode([[1,1]]) -> String
*
* Decodes a polyline.
*/
static VALUE
decode(int argc, VALUE *argv, VALUE self) {
I've tried naming the method various ways, such as rb_FastPolylines__decode, rb_fast_polylines_decode, rb_decode. None worked..
I've been looking on internet, but couldn't find any convincing resource on How to document a ruby C extension. Do you have any inputs on this ?

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.

Trying to find a reference to the manual but can't [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
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).

Xcode code generation [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 was wondering if there is a tool (automator script or a third party) to generate code for simple scenarios like add another property. I don't like going to two or three places and write the same thing over and over again. instead I want to say "I want a new property of type int with name X" and it generates the lines in .h and .m files for me in one go.
I haven't actually used either, but xobjc is free (though requires you to do some code annotations) and Accessorizer looks interesting if somewhat complicated to setup.

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