pry-docmore 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/docmores.yaml +618 -0
  2. data/lib/pry-docmore.rb +7 -6
  3. metadata +4 -98
  4. data/pry-docmore.wiki/Home.md +0 -96
  5. data/pry-docmore.wiki/Ruby Global $! (DollarBang).md +0 -15
  6. data/pry-docmore.wiki/Ruby Global $/" (DollarQuote).md" +0 -4
  7. data/pry-docmore.wiki/Ruby Global $$ (DollarDollar).md +0 -12
  8. data/pry-docmore.wiki/Ruby Global $& (DollarAmpersand).md +0 -16
  9. data/pry-docmore.wiki/Ruby Global $' (DollarTick).md +0 -16
  10. data/pry-docmore.wiki/Ruby Global $* (DollarStar).md +0 -1
  11. data/pry-docmore.wiki/Ruby Global $+ (DollarPlus).md +0 -9
  12. data/pry-docmore.wiki/Ruby Global $, (DollarComma).md +0 -1
  13. data/pry-docmore.wiki/Ruby Global $-0 (DollarDashZero).md +0 -1
  14. data/pry-docmore.wiki/Ruby Global $-F (DollarDashF).md +0 -1
  15. data/pry-docmore.wiki/Ruby Global $-I (DollarDashI).md +0 -1
  16. data/pry-docmore.wiki/Ruby Global $-K (DollarDashK).md +0 -1
  17. data/pry-docmore.wiki/Ruby Global $-W (DollarDashW).md +0 -1
  18. data/pry-docmore.wiki/Ruby Global $-a (DollarDasha).md +0 -1
  19. data/pry-docmore.wiki/Ruby Global $-d (DollarDashd).md +0 -1
  20. data/pry-docmore.wiki/Ruby Global $-i (DollarDashi).md +0 -1
  21. data/pry-docmore.wiki/Ruby Global $-l (DollarDashl).md +0 -1
  22. data/pry-docmore.wiki/Ruby Global $-p (DollarDashp).md +0 -1
  23. data/pry-docmore.wiki/Ruby Global $-v (DollarDashv).md +0 -1
  24. data/pry-docmore.wiki/Ruby Global $-w (DollarDashw).md +0 -1
  25. data/pry-docmore.wiki/Ruby Global $. (DollarDot).md +0 -1
  26. data/pry-docmore.wiki/Ruby Global $0 (DollarZero).md +0 -2
  27. data/pry-docmore.wiki/Ruby Global $1 (DollarOne).md +0 -1
  28. data/pry-docmore.wiki/Ruby Global $2 (DollarTwo).md +0 -1
  29. data/pry-docmore.wiki/Ruby Global $3 (DollarThree).md +0 -1
  30. data/pry-docmore.wiki/Ruby Global $4 (DollarFour).md +0 -1
  31. data/pry-docmore.wiki/Ruby Global $5 (DollarFive).md +0 -1
  32. data/pry-docmore.wiki/Ruby Global $6 (DollarSix).md +0 -1
  33. data/pry-docmore.wiki/Ruby Global $7 (DollarSeven).md +0 -1
  34. data/pry-docmore.wiki/Ruby Global $8 (DollarEight).md +0 -1
  35. data/pry-docmore.wiki/Ruby Global $9 (DollarNine).md +0 -1
  36. data/pry-docmore.wiki/Ruby Global $: (DollarColon).md +0 -3
  37. data/pry-docmore.wiki/Ruby Global $; (DollarSemicolon).md +0 -1
  38. data/pry-docmore.wiki/Ruby Global $< (DollarLessthan).md +0 -1
  39. data/pry-docmore.wiki/Ruby Global $= (DollarEquals).md +0 -2
  40. data/pry-docmore.wiki/Ruby Global $> (DollarGreaterthan).md +0 -1
  41. data/pry-docmore.wiki/Ruby Global $? (Dollar?).md +0 -11
  42. data/pry-docmore.wiki/Ruby Global $@ (DollarAt).md +0 -2
  43. data/pry-docmore.wiki/Ruby Global $DEBUG (DollarDEBUG).md +0 -1
  44. data/pry-docmore.wiki/Ruby Global $FILENAME (DollarFILENAME).md +0 -1
  45. data/pry-docmore.wiki/Ruby Global $KCODE (DollarKCODE).md +0 -1
  46. data/pry-docmore.wiki/Ruby Global $LOADED_FEATURES (DollarLOADEDUnderscoreFEATURES).md +0 -1
  47. data/pry-docmore.wiki/Ruby Global $LOAD_PATH (DollarLOADUnderscorePATH).md +0 -1
  48. data/pry-docmore.wiki/Ruby Global $PROGRAM_NAME (DollarPROGRAMUnderscoreNAME).md +0 -1
  49. data/pry-docmore.wiki/Ruby Global $SAFE (DollarSAFE).md +0 -4
  50. data/pry-docmore.wiki/Ruby Global $VERBOSE (DollarVERBOSE).md +0 -1
  51. data/pry-docmore.wiki/Ruby Global $// (DollarBackslash).md" +0 -1
  52. data/pry-docmore.wiki/Ruby Global $_ (DollarUnderscore).md +0 -1
  53. data/pry-docmore.wiki/Ruby Global $` (DollarBacktick).md +0 -16
  54. data/pry-docmore.wiki/Ruby Global $stderr (Dollarstderr).md +0 -1
  55. data/pry-docmore.wiki/Ruby Global $stdin (Dollarstdin).md +0 -1
  56. data/pry-docmore.wiki/Ruby Global $stdout (Dollarstdout).md +0 -1
  57. data/pry-docmore.wiki/Ruby Global $~ (DollarSquiggle).md +0 -1
  58. data/pry-docmore.wiki/Ruby Global $/342/201/204 (DollarSlash).md" +0 -3
  59. data/pry-docmore.wiki/Ruby Keyword: BEGIN.md +0 -14
  60. data/pry-docmore.wiki/Ruby Keyword: END.md +0 -10
  61. data/pry-docmore.wiki/Ruby Keyword: __ENCODING__.md +0 -8
  62. data/pry-docmore.wiki/Ruby Keyword: __FILE__.md +0 -5
  63. data/pry-docmore.wiki/Ruby Keyword: __LINE__.md +0 -12
  64. data/pry-docmore.wiki/Ruby Keyword: alias.md +0 -38
  65. data/pry-docmore.wiki/Ruby Keyword: and.md +0 -29
  66. data/pry-docmore.wiki/Ruby Keyword: begin.md +0 -24
  67. data/pry-docmore.wiki/Ruby Keyword: break.md +0 -22
  68. data/pry-docmore.wiki/Ruby Keyword: case.md +0 -25
  69. data/pry-docmore.wiki/Ruby Keyword: class.md +0 -4
  70. data/pry-docmore.wiki/Ruby Keyword: def.md +0 -14
  71. data/pry-docmore.wiki/Ruby Keyword: defined?.md +0 -29
  72. data/pry-docmore.wiki/Ruby Keyword: do.md +0 -3
  73. data/pry-docmore.wiki/Ruby Keyword: else.md +0 -4
  74. data/pry-docmore.wiki/Ruby Keyword: elsif.md +0 -3
  75. data/pry-docmore.wiki/Ruby Keyword: end.md +0 -2
  76. data/pry-docmore.wiki/Ruby Keyword: ensure.md +0 -1
  77. data/pry-docmore.wiki/Ruby Keyword: false.md +0 -9
  78. data/pry-docmore.wiki/Ruby Keyword: for.md +0 -14
  79. data/pry-docmore.wiki/Ruby Keyword: if.md +0 -5
  80. data/pry-docmore.wiki/Ruby Keyword: in.md +0 -3
  81. data/pry-docmore.wiki/Ruby Keyword: module.md +0 -31
  82. data/pry-docmore.wiki/Ruby Keyword: next.md +0 -15
  83. data/pry-docmore.wiki/Ruby Keyword: nil.md +0 -3
  84. data/pry-docmore.wiki/Ruby Keyword: not.md +0 -10
  85. data/pry-docmore.wiki/Ruby Keyword: or.md +0 -22
  86. data/pry-docmore.wiki/Ruby Keyword: redo.md +0 -16
  87. data/pry-docmore.wiki/Ruby Keyword: rescue.md +0 -55
  88. data/pry-docmore.wiki/Ruby Keyword: retry.md +0 -20
  89. data/pry-docmore.wiki/Ruby Keyword: return.md +0 -38
  90. data/pry-docmore.wiki/Ruby Keyword: self.md +0 -15
  91. data/pry-docmore.wiki/Ruby Keyword: super.md +0 -34
  92. data/pry-docmore.wiki/Ruby Keyword: then.md +0 -17
  93. data/pry-docmore.wiki/Ruby Keyword: true.md +0 -7
  94. data/pry-docmore.wiki/Ruby Keyword: undef.md +0 -5
  95. data/pry-docmore.wiki/Ruby Keyword: unless.md +0 -4
  96. data/pry-docmore.wiki/Ruby Keyword: until.md +0 -6
  97. data/pry-docmore.wiki/Ruby Keyword: when.md +0 -1
  98. data/pry-docmore.wiki/Ruby Keyword: while.md +0 -6
  99. data/pry-docmore.wiki/Ruby Keyword: yield.md +0 -16
@@ -1 +0,0 @@
1
- The $KCODE global ...pry-docmore TODO!
@@ -1 +0,0 @@
1
- The $PROGRAM_NAME global Same as $0 - Contains the name of the script being executed. May be assignable.
@@ -1,4 +0,0 @@
1
- This variable determines the "level of paranoia", restricting the set of legal
2
- operations.
3
-
4
- See: http://www.ruby-doc.org/docs/ProgrammingRuby/html/taint.html
@@ -1 +0,0 @@
1
- The $VERBOSE global is the verbose flag, which is set by the -v switch.
@@ -1 +0,0 @@
1
- The $\ global is the output record separator for the print and IO#write. Default is nil.
@@ -1 +0,0 @@
1
- The $_ global is the last input line of string by `gets` or `readline`.
@@ -1,16 +0,0 @@
1
- The $` global is the string to the left of the last successful match.
2
-
3
- If you do this:
4
-
5
- str = 'hello goodbye'; str[/good/]
6
-
7
- Then this:
8
-
9
- [ $`, $&, $' ]
10
-
11
- Yields this:
12
- [
13
- "hello ",
14
- "good",
15
- "bye"
16
- ]
@@ -1 +0,0 @@
1
- The $stderr global is the current standard error output.
@@ -1 +0,0 @@
1
- The $stdin global is the current standard input.
@@ -1 +0,0 @@
1
- The $stdout global is the current standard output.
@@ -1 +0,0 @@
1
- The $~ global is the match-data about the last match in the current scope.
@@ -1,3 +0,0 @@
1
- The $/ global is the input record separator, newline by default.
2
-
3
- This affects String#each_lines, String#lines, and String#chomp
@@ -1,14 +0,0 @@
1
- Like Perl and Awk before that, defines a block to be run before the others:
2
-
3
- p 3
4
- BEGIN { p 1 }
5
- p 4
6
- BEGIN { p 2 }
7
- # …prints these out as 1, 2, 3, 4
8
-
9
- This works because the whole file gets parsed at the beginning (even though
10
- 'class' and 'def' lines are not executed early), so the interpreter can reorder
11
- these statements.
12
-
13
- See also: `END`
14
- (Not to be confused with lower-case `begin`)
@@ -1,10 +0,0 @@
1
- Like Perl and Awk before that, defines a block to be run after the others:
2
-
3
- p 1
4
- END { p 4 }
5
- p 2
6
- END { p 3 }
7
- # …prints these out as 1, 2, 3, 4
8
-
9
- See also: `BEGIN`
10
- (Not to be confused with lower-case `end`)
@@ -1,8 +0,0 @@
1
- Read-only value of the current Encoding object (which has methods:
2
- ascii_compatible? dummy? inspect name names replicate to_s)
3
-
4
- By default is: #<Encoding:US-ASCII>
5
-
6
- But can be affected by the 1st or 2nd line of the file being something like:
7
-
8
- # encoding: utf-8
@@ -1,5 +0,0 @@
1
- The filename of the code being evaluated. Evaluates to "(pry)" within the REPL.
2
-
3
- Useful especially for code to locate parts nearby, such as:
4
-
5
- File.dirname(__FILE__)
@@ -1,12 +0,0 @@
1
- The code's current line number. Can be a handy way to pepper what would
2
- otherwise be `print "Got here 1"` statements in your code, e.g.:
3
-
4
- if a
5
- p __LINE__
6
- # some stuff
7
- else
8
- p __LINE__
9
- # some other stuff
10
- end
11
-
12
- …but you use the pry-debugger gem instead, don't you?
@@ -1,38 +0,0 @@
1
- The alias keyword is used to make synonyms of methods.
2
-
3
- If you are used to the semantics of the `/bin/ln` command, get it out of your
4
- head right now: Ruby does the opposite. That is, instead of `ln existing
5
- new`, Ruby's semantics are `alias new existing`. (Mnested Mnemonic: this `new`
6
- sorting is the b`a`-`n`-`e` of my `exist`ence.)
7
-
8
- Also take particular note that this is not a method call, but a keyword, so
9
- it can do things method calls cannot. The args are not :symbols (though they
10
- are permitted to be), and it is a SyntaxError to attempt to place a comma
11
- between the args.
12
-
13
- Note that, this being a keyword and happening at compile-time, is not enough
14
- to make dynamic assignments. See {Module#alias_method} for that kind of
15
- trickery.
16
-
17
- Basic Usage
18
-
19
- def foo; 3 end
20
- alias boo foo
21
- boo
22
- ⇒ 3
23
-
24
- Symbols as args
25
-
26
- alias :zoo :boo # or even mix and match, if you want to for some reason.
27
- zoo
28
- ⇒ 3
29
-
30
- Some decorating!
31
-
32
- alias orig_foo foo
33
- def foo; 4 + orig_foo end
34
- foo
35
- ⇒ 7
36
- # See also Rails's alias_method_chain for a formalization of this idiom.
37
-
38
- See also: http://kresimirbojcic.com/2011/12/01/decorators-in-ruby.html
@@ -1,29 +0,0 @@
1
- Boolean conjunction.
2
-
3
- Only evaluates to `true` if both its left and right side are true.
4
-
5
- Remember that the 'and' operator is lower precedence operator than '&&', so
6
-
7
- an_expression and another_expression
8
- is roughly equivalent to:
9
- (an_expression) && (another_expression)
10
-
11
- Truth table
12
-
13
- true and true ⇒ true
14
- false and true ⇒ false
15
- false and false ⇒ false
16
-
17
- Precedence
18
-
19
- true and not false ⇒ true
20
- true && not false ⇒ SyntaxError
21
- a = true and false; a ⇒ true
22
- a = true && false; a ⇒ false
23
-
24
- The fowl chain
25
-
26
- if false or true && false then false elsif true and false or true then true end
27
- ⇒ true
28
-
29
- See http://phrogz.net/ProgrammingRuby/language.html#table_18.4
@@ -1,24 +0,0 @@
1
- Opens a block when `def` or `do` isn't already opening one for you.
2
-
3
- Uses include:
4
-
5
- begin
6
- 1/0
7
- rescue => e
8
- p e
9
- else
10
- puts 'Cannot get here with that 1/0'
11
- ensure
12
- puts 'OK then.'
13
- end
14
-
15
- Or something like:
16
-
17
- x = something_falsy || begin
18
- several_steps
19
- go_here
20
- 3
21
- end
22
- # Now x == 3
23
-
24
- (Not to be confused with the BEGIN keyword.)
@@ -1,22 +0,0 @@
1
- Hops out of the inner-most loop. Like this:
2
-
3
- %w(a b c).each do |i|
4
- print i
5
- 32343.times do |j|
6
- break if j > 2
7
- print j
8
- end
9
- end
10
- puts
11
-
12
- Prints:
13
-
14
- a012b012c012
15
-
16
- Also note that the keyword accepts an argument:
17
-
18
- x = loop do break 3 end
19
- p x
20
- # ⇒ 3
21
-
22
- Compare with: next, last
@@ -1,25 +0,0 @@
1
- A convenient conditional that doesn't require the "subject" to be repeated.
2
-
3
- Uses #=== for comparison ("the threequals"), which is defined specially for
4
- various objects.
5
-
6
- x = 'asdf'
7
- case x
8
- when 'asdf'; puts 'Found it!'
9
- when 'fghj'; puts 'Impossible.'
10
- else puts 'Also impossible.'
11
- end
12
-
13
- case x
14
- when String; puts 'Yep, will get here.'
15
- when Array; puts 'Actually, wait a minute.'
16
- when Hash; puts 'This is pretty bad OO.'
17
- else puts 'But, the code works'
18
- end
19
-
20
- case x
21
- when /^[fdsa]{4}/; puts 'Whoa, works with regexes.'
22
- else puts 'Will not get here.'
23
- end
24
-
25
- Also works with `Range`s
@@ -1,4 +0,0 @@
1
- - Opens a class definition
2
- - class << self ← Opens the eigenclass of 'self'
3
-
4
- TODO - https://github.com/rking/pry-docmore/wiki
@@ -1,14 +0,0 @@
1
- Define a method.
2
-
3
- # TODO:
4
- # Describe various signatures
5
- # def foo
6
- # def foo arg
7
- # def foo arg, arg2
8
- # def foo *args
9
- # def foo arg, *args, arg3
10
- # …Ruby 2.0 keyword args?
11
- # Talk about eigenclasses
12
-
13
- Doesn't work inside another `def`, but can work inside blocks. Compare to
14
- Module#define_method, which is capable of doing more dynamic tricks.
@@ -1,29 +0,0 @@
1
- defined? nil ⇒ "nil"
2
- defined? self ⇒ "self"
3
- defined? true ⇒ "true"
4
- defined? false ⇒ "false"
5
- defined? "asdf" ⇒ "expression"
6
- defined? a = 3 ⇒ "assignment" # but doesn't actually set a to 3.
7
- defined? printf ⇒ "method"
8
- printf = 3
9
- defined? printf ⇒ "local-variable" # nil if there is no local or method with that name
10
- defined? $foo ⇒ "global-variable" # nil if $foo has not been assigned to
11
- defined? Object ⇒ "constant" # nil if there is no constant with that name
12
- defined? super ⇒ "super" # nil if there is no super method.
13
- defined? yield ⇒ "yield" # nil if no block was passed to this method
14
-
15
- defined? is most often used to determine whether a constant or global variable is defined. For example ruby-1.8.7 didn't have a RUBY_ENGINE constant, so jruby was often detected using:
16
-
17
- defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
18
-
19
- Another idiomatic use is to safely call a super-method:
20
-
21
- super if defined?(super)
22
-
23
- It can be used to detect whether a block was passed to this method, though `block_given?` is usually preferred.
24
-
25
- yield if defined?(yield)
26
-
27
- Although the return value of `defined?` is a string, this is usually ignored and only the truthiness of the result considered.
28
-
29
- Improve these docs at https://github.com/rking/pry-docmore/wiki
@@ -1,3 +0,0 @@
1
- The beginning of a block, to be passed to a method call.
2
-
3
- TODO - https://github.com/rking/pry-docmore/wiki
@@ -1,4 +0,0 @@
1
- The part of a condition that happens when none if the `if` or `elsif` parts
2
- hold true. Also works with `case` and `rescue`.
3
-
4
- TODO - https://github.com/rking/pry-docmore/wiki
@@ -1,3 +0,0 @@
1
- Is only checked when the preceding `if`/`elsif` conditions evaluated false.
2
-
3
- TODO - https://github.com/rking/pry-docmore/wiki
@@ -1,2 +0,0 @@
1
- The single biggest wart in the Ruby syntax (because sleeker languages, such as
2
- CoffeeScript, imply it by indentation.)
@@ -1 +0,0 @@
1
- The sibling of `require` that is run when there is or isn't an exception.
@@ -1,9 +0,0 @@
1
- In Ruby, only `false` and `nil` evaluate to false.
2
-
3
- def false_check x
4
- return if nil == x
5
- return if false == x
6
- unless x
7
- puts "This will never ever get reached."
8
- end
9
- end
@@ -1,14 +0,0 @@
1
- A fairly rarely used keyword in Ruby, because we like to write the Enumerable
2
- on the left side to remind us that we're not programming in some other lanuage.
3
-
4
- But, actually, it is a golf win:
5
-
6
- (2..5).each do |i|
7
- p i
8
- end
9
-
10
- Is equivalent to:
11
-
12
- for i in 2..5
13
- p i
14
- end
@@ -1,5 +0,0 @@
1
- That most fundamental of computing tools.
2
-
3
- See: https://en.wikipedia.org/wiki/Turing_completeness
4
-
5
- But also see: http://www.refactoring.com/catalog/replaceConditionalWithPolymorphism.html
@@ -1,3 +0,0 @@
1
- Goes with the `for` keyword.
2
-
3
- # Anything else? If so, let us know: https://github.com/rking/pry-docmore/wiki
@@ -1,31 +0,0 @@
1
- Usage: module ModuleName; module-contents end
2
-
3
- Defines a new Module, or re-opens an existing module. Modules in ruby are
4
- collections of code, they have two distinct use-cases:
5
-
6
- 1. As a Namespace. Often all of the code in a rubygem will be written in the
7
- same module to avoid naming collisions with code not in that Gem.
8
-
9
- 2. As a set of shared functions. Modules can be included into Classes, which
10
- makes all of the methods defined in the module available to instances of the
11
- class. This can be used to emulate multiple-inheritance, or to divide one large
12
- class into more manageable chunks.
13
-
14
- Note that, though the class `Class` inherits from `Module`, this is more of an
15
- implementation detail than a direct, Liskov-substitutable interface: modules
16
- can be `include`d, `extend`ed or `using`d, while classes cannot. (On the other
17
- hand, classes can be instantiated, where modules cannot).
18
-
19
- module X
20
- def foo; 2 end
21
- end
22
- class Y; include X end
23
- class Z; extend X end
24
- # Now, these work:
25
- Y.new.foo
26
- Z.foo
27
- # "extend just calls include on the eigenclass"
28
- # Mnemonic! INclude for INstances, Extend for sElf
29
-
30
- For all you ever wanted to know about constant lookup, see:
31
- http://cirw.in/blog/constant-lookup
@@ -1,15 +0,0 @@
1
- Skip to the next iteration of the inner-most loop.
2
-
3
- For example:
4
-
5
- 10.times do |i|
6
- next unless 0 == i % 3
7
- print i
8
- end
9
- puts
10
-
11
- Prints:
12
-
13
- 0369
14
-
15
- Compare with: break, last
@@ -1,3 +0,0 @@
1
- Represents "nothing whatsoever".
2
-
3
- Along with `false`, is the other value that evaluates to false in conditionals.
@@ -1,10 +0,0 @@
1
- Boolean negation.
2
-
3
- if not x
4
-
5
- is equivalent to:
6
-
7
- unless x
8
-
9
- Note that the precedence is lower than for `!`. # TODO: elaborate, w/ examples.
10
- See: http://phrogz.net/ProgrammingRuby/language.html#table_18.4