english 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/English.gemspec +23 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +21 -0
- data/README.md +51 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/English.rb +182 -0
- metadata +54 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9d377452da7d72cc144fdb11dd2040f481280094e424f9c8a50a6430c135e4ff
|
4
|
+
data.tar.gz: 12c628e6adc8d173282a30eb4a54e7e9aabe5be080f67b9305a8991e32031f7d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4feb7f2cf93c802218839e8fa925adc36cc007172e8443fd0f4a0efc33d9029b39f02fd349148a852be6fd2e8659fcdc03e4e8c7bc3c7719752a541dae46007e
|
7
|
+
data.tar.gz: 8bbf34ab65acdbe7e6ea4e4888de3a8ebded76d3b705421892aaa213b345c6fb725b1269b4a4befed2b2c231a4205497209bd3063464e6aa1c8171d53e6bbeb0
|
data/.gitignore
ADDED
data/English.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "english"
|
3
|
+
spec.version = "0.7.0"
|
4
|
+
spec.authors = ["Yukihiro Matsumoto"]
|
5
|
+
spec.email = ["matz@ruby-lang.org"]
|
6
|
+
|
7
|
+
spec.summary = %q{Require 'English.rb' to reference global variables with less cryptic names.}
|
8
|
+
spec.description = %q{Require 'English.rb' to reference global variables with less cryptic names.}
|
9
|
+
spec.homepage = "https://github.com/ruby/English"
|
10
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
11
|
+
|
12
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
13
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
14
|
+
|
15
|
+
# Specify which files should be added to the gem when it is released.
|
16
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
end
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
English (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
minitest (5.14.0)
|
10
|
+
rake (12.3.3)
|
11
|
+
|
12
|
+
PLATFORMS
|
13
|
+
ruby
|
14
|
+
|
15
|
+
DEPENDENCIES
|
16
|
+
English!
|
17
|
+
minitest (~> 5.0)
|
18
|
+
rake (~> 12.0)
|
19
|
+
|
20
|
+
BUNDLED WITH
|
21
|
+
2.1.4
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# English
|
2
|
+
|
3
|
+
Include the English library file in a Ruby script, and you can
|
4
|
+
reference the global variables such as <tt>$_</tt> using less
|
5
|
+
cryptic names, listed below.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'English'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install English
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Without 'English':
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
$\ = ' -- '
|
29
|
+
"waterbuffalo" =~ /buff/
|
30
|
+
print $', $$, "\n"
|
31
|
+
```
|
32
|
+
|
33
|
+
With English:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
require "English"
|
37
|
+
|
38
|
+
$OUTPUT_FIELD_SEPARATOR = ' -- '
|
39
|
+
"waterbuffalo" =~ /buff/
|
40
|
+
print $POSTMATCH, $PID, "\n"
|
41
|
+
```
|
42
|
+
|
43
|
+
## Development
|
44
|
+
|
45
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
46
|
+
|
47
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/English.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "English"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/English.rb
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Include the English library file in a Ruby script, and you can
|
3
|
+
# reference the global variables such as <tt>$_</tt> using less
|
4
|
+
# cryptic names, listed below.
|
5
|
+
#
|
6
|
+
# Without 'English':
|
7
|
+
#
|
8
|
+
# $\ = ' -- '
|
9
|
+
# "waterbuffalo" =~ /buff/
|
10
|
+
# print $', $$, "\n"
|
11
|
+
#
|
12
|
+
# With English:
|
13
|
+
#
|
14
|
+
# require "English"
|
15
|
+
#
|
16
|
+
# $OUTPUT_FIELD_SEPARATOR = ' -- '
|
17
|
+
# "waterbuffalo" =~ /buff/
|
18
|
+
# print $POSTMATCH, $PID, "\n"
|
19
|
+
#
|
20
|
+
# Below is a full list of descriptive aliases and their associated global
|
21
|
+
# variable:
|
22
|
+
#
|
23
|
+
# $ERROR_INFO:: $!
|
24
|
+
# $ERROR_POSITION:: $@
|
25
|
+
# $FS:: $;
|
26
|
+
# $FIELD_SEPARATOR:: $;
|
27
|
+
# $OFS:: $,
|
28
|
+
# $OUTPUT_FIELD_SEPARATOR:: $,
|
29
|
+
# $RS:: $/
|
30
|
+
# $INPUT_RECORD_SEPARATOR:: $/
|
31
|
+
# $ORS:: $\
|
32
|
+
# $OUTPUT_RECORD_SEPARATOR:: $\
|
33
|
+
# $INPUT_LINE_NUMBER:: $.
|
34
|
+
# $NR:: $.
|
35
|
+
# $LAST_READ_LINE:: $_
|
36
|
+
# $DEFAULT_OUTPUT:: $>
|
37
|
+
# $DEFAULT_INPUT:: $<
|
38
|
+
# $PID:: $$
|
39
|
+
# $PROCESS_ID:: $$
|
40
|
+
# $CHILD_STATUS:: $?
|
41
|
+
# $LAST_MATCH_INFO:: $~
|
42
|
+
# $IGNORECASE:: $=
|
43
|
+
# $ARGV:: $*
|
44
|
+
# $MATCH:: $&
|
45
|
+
# $PREMATCH:: $`
|
46
|
+
# $POSTMATCH:: $'
|
47
|
+
# $LAST_PAREN_MATCH:: $+
|
48
|
+
#
|
49
|
+
module English end if false
|
50
|
+
|
51
|
+
# The exception object passed to +raise+.
|
52
|
+
alias $ERROR_INFO $!
|
53
|
+
|
54
|
+
# The stack backtrace generated by the last
|
55
|
+
# exception. See Kernel#caller for details. Thread local.
|
56
|
+
alias $ERROR_POSITION $@
|
57
|
+
|
58
|
+
# The default separator pattern used by String#split. May be set from
|
59
|
+
# the command line using the <tt>-F</tt> flag.
|
60
|
+
alias $FS $;
|
61
|
+
|
62
|
+
# The default separator pattern used by String#split. May be set from
|
63
|
+
# the command line using the <tt>-F</tt> flag.
|
64
|
+
alias $FIELD_SEPARATOR $;
|
65
|
+
|
66
|
+
# The separator string output between the parameters to methods such
|
67
|
+
# as Kernel#print and Array#join. Defaults to +nil+, which adds no
|
68
|
+
# text.
|
69
|
+
alias $OFS $,
|
70
|
+
|
71
|
+
# The separator string output between the parameters to methods such
|
72
|
+
# as Kernel#print and Array#join. Defaults to +nil+, which adds no
|
73
|
+
# text.
|
74
|
+
alias $OUTPUT_FIELD_SEPARATOR $,
|
75
|
+
|
76
|
+
# The input record separator (newline by default). This is the value
|
77
|
+
# that routines such as Kernel#gets use to determine record
|
78
|
+
# boundaries. If set to +nil+, +gets+ will read the entire file.
|
79
|
+
alias $RS $/
|
80
|
+
|
81
|
+
# The input record separator (newline by default). This is the value
|
82
|
+
# that routines such as Kernel#gets use to determine record
|
83
|
+
# boundaries. If set to +nil+, +gets+ will read the entire file.
|
84
|
+
alias $INPUT_RECORD_SEPARATOR $/
|
85
|
+
|
86
|
+
# The string appended to the output of every call to methods such as
|
87
|
+
# Kernel#print and IO#write. The default value is +nil+.
|
88
|
+
alias $ORS $\
|
89
|
+
|
90
|
+
# The string appended to the output of every call to methods such as
|
91
|
+
# Kernel#print and IO#write. The default value is +nil+.
|
92
|
+
alias $OUTPUT_RECORD_SEPARATOR $\
|
93
|
+
|
94
|
+
# The number of the last line read from the current input file.
|
95
|
+
alias $INPUT_LINE_NUMBER $.
|
96
|
+
|
97
|
+
# The number of the last line read from the current input file.
|
98
|
+
alias $NR $.
|
99
|
+
|
100
|
+
# The last line read by Kernel#gets or
|
101
|
+
# Kernel#readline. Many string-related functions in the
|
102
|
+
# Kernel module operate on <tt>$_</tt> by default. The variable is
|
103
|
+
# local to the current scope. Thread local.
|
104
|
+
alias $LAST_READ_LINE $_
|
105
|
+
|
106
|
+
# The destination of output for Kernel#print
|
107
|
+
# and Kernel#printf. The default value is
|
108
|
+
# <tt>$stdout</tt>.
|
109
|
+
alias $DEFAULT_OUTPUT $>
|
110
|
+
|
111
|
+
# An object that provides access to the concatenation
|
112
|
+
# of the contents of all the files
|
113
|
+
# given as command-line arguments, or <tt>$stdin</tt>
|
114
|
+
# (in the case where there are no
|
115
|
+
# arguments). <tt>$<</tt> supports methods similar to a
|
116
|
+
# File object:
|
117
|
+
# +inmode+, +close+,
|
118
|
+
# <tt>closed?</tt>, +each+,
|
119
|
+
# <tt>each_byte</tt>, <tt>each_line</tt>,
|
120
|
+
# +eof+, <tt>eof?</tt>, +file+,
|
121
|
+
# +filename+, +fileno+,
|
122
|
+
# +getc+, +gets+, +lineno+,
|
123
|
+
# <tt>lineno=</tt>, +path+,
|
124
|
+
# +pos+, <tt>pos=</tt>,
|
125
|
+
# +read+, +readchar+,
|
126
|
+
# +readline+, +readlines+,
|
127
|
+
# +rewind+, +seek+, +skip+,
|
128
|
+
# +tell+, <tt>to_a</tt>, <tt>to_i</tt>,
|
129
|
+
# <tt>to_io</tt>, <tt>to_s</tt>, along with the
|
130
|
+
# methods in Enumerable. The method +file+
|
131
|
+
# returns a File object for the file currently
|
132
|
+
# being read. This may change as <tt>$<</tt> reads
|
133
|
+
# through the files on the command line. Read only.
|
134
|
+
alias $DEFAULT_INPUT $<
|
135
|
+
|
136
|
+
# The process number of the program being executed. Read only.
|
137
|
+
alias $PID $$
|
138
|
+
|
139
|
+
# The process number of the program being executed. Read only.
|
140
|
+
alias $PROCESS_ID $$
|
141
|
+
|
142
|
+
# The exit status of the last child process to terminate. Read
|
143
|
+
# only. Thread local.
|
144
|
+
alias $CHILD_STATUS $?
|
145
|
+
|
146
|
+
# A +MatchData+ object that encapsulates the results of a successful
|
147
|
+
# pattern match. The variables <tt>$&</tt>, <tt>$`</tt>, <tt>$'</tt>,
|
148
|
+
# and <tt>$1</tt> to <tt>$9</tt> are all derived from
|
149
|
+
# <tt>$~</tt>. Assigning to <tt>$~</tt> changes the values of these
|
150
|
+
# derived variables. This variable is local to the current
|
151
|
+
# scope.
|
152
|
+
alias $LAST_MATCH_INFO $~
|
153
|
+
|
154
|
+
# This variable is no longer effective. Deprecated.
|
155
|
+
alias $IGNORECASE $=
|
156
|
+
|
157
|
+
# An array of strings containing the command-line
|
158
|
+
# options from the invocation of the program. Options
|
159
|
+
# used by the Ruby interpreter will have been
|
160
|
+
# removed. Read only. Also known simply as +ARGV+.
|
161
|
+
alias $ARGV $*
|
162
|
+
|
163
|
+
# The string matched by the last successful pattern
|
164
|
+
# match. This variable is local to the current
|
165
|
+
# scope. Read only.
|
166
|
+
alias $MATCH $&
|
167
|
+
|
168
|
+
# The string preceding the match in the last
|
169
|
+
# successful pattern match. This variable is local to
|
170
|
+
# the current scope. Read only.
|
171
|
+
alias $PREMATCH $`
|
172
|
+
|
173
|
+
# The string following the match in the last
|
174
|
+
# successful pattern match. This variable is local to
|
175
|
+
# the current scope. Read only.
|
176
|
+
alias $POSTMATCH $'
|
177
|
+
|
178
|
+
# The contents of the highest-numbered group matched in the last
|
179
|
+
# successful pattern match. Thus, in <tt>"cat" =~ /(c|a)(t|z)/</tt>,
|
180
|
+
# <tt>$+</tt> will be set to "t". This variable is local to the
|
181
|
+
# current scope. Read only.
|
182
|
+
alias $LAST_PAREN_MATCH $+
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: english
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yukihiro Matsumoto
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-04-07 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Require 'English.rb' to reference global variables with less cryptic
|
14
|
+
names.
|
15
|
+
email:
|
16
|
+
- matz@ruby-lang.org
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- ".gitignore"
|
22
|
+
- English.gemspec
|
23
|
+
- Gemfile
|
24
|
+
- Gemfile.lock
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- bin/console
|
28
|
+
- bin/setup
|
29
|
+
- lib/English.rb
|
30
|
+
homepage: https://github.com/ruby/English
|
31
|
+
licenses: []
|
32
|
+
metadata:
|
33
|
+
homepage_uri: https://github.com/ruby/English
|
34
|
+
source_code_uri: https://github.com/ruby/English
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.3.0
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubygems_version: 3.2.0.pre1
|
51
|
+
signing_key:
|
52
|
+
specification_version: 4
|
53
|
+
summary: Require 'English.rb' to reference global variables with less cryptic names.
|
54
|
+
test_files: []
|