发表时间

Rails 生成器是必不可少的提高工作效率工具。通过本文您将学会如何创建生成器和定制以有生成器。

通过阅读本文,您将了解:

作者

发表时间

蒙古学,其实不是一个学科,而是一个根蒙古族有关的涉及多学科的综合性学科。

其英文写法,传统是 Mongolian Studies,根据学科命名方法,也可以写做 Mongolology。

作者
分类 蒙古学

发表时间

Ruby(3.2) 中使用了下列关键词(也成保留字):

ENCODING
当前文件的编码。参阅 Encoding
LINE
关键词在当前文件中的行号。
FILE
当前文件路径。
BEGIN
当前文件中最先运行的代码。参阅 miscellaneous syntax
END
当前文件中所有代码运行完之后再运行。参阅 miscellaneous syntax
alias
为两个方法之间创建一个别名(或者其它)。查阅 模块和类语法
and
优先值低于 && 的短路布尔值 and
begin
开始一个意外情况处理代码块。查阅 意外语法
break
跳离一个块。查阅 流控制表达式语法
case
开始 case 表达式。查阅 流控制表达式语法
class
创建或者打开一个类。查阅 模块和类的语法
def
定义一个方法。查阅 方法语法
defined?
返回一个描述参数的字符串。查阅 miscellaneous syntax
do
开始一个代码块。
else
caseifunless 表达式中受控条件之外的情况。查阅 流控制表达式
elsif
if 表达式的一个替代条件表达方式。查阅 流控制表达式
end
代码语法块的结束标志。用于类、模块、方法、意外处理和流控制。
ensure
Starts a section of code that is always run when an exception is raised. See exception handling
false
布尔值 false。查阅 字面量1(literal)
for
A loop that is similar to using the each method. See control expressions
if
Used for if and modifier if statements. See control expressions
in
Used to separate the iterable object and iterator variable in a for loop. See control expressions It also serves as a pattern in a case expression. See pattern matching
module
Creates or opens a module. See modules and classes syntax
next
Skips the rest of the block. See control expressions
nil
A false value usually indicating “no value” or “unknown”. See literals
not
Inverts the following boolean expression. Has a lower precedence than !
or
Boolean or with lower precedence than ||
redo
Restarts execution in the current block. See control expressions
rescue
Starts an exception section of code in a begin block. See exception handling
retry
Retries an exception block. See exception handling
return
Exits a method. See methods. If met in top-level scope, immediately stops interpretation of the current file.
self
The object the current method is attached to. See methods
super
Calls the current method in a superclass. See methods
then
Indicates the end of conditional blocks in control structures. See control expressions
undef
Prevents a class or module from responding to a method call. See modules and classes
unless
Used for unless and modifier unless statements. See control expressions
until
Creates a loop that executes until the condition is true. See control expressions
when
A condition in a case expression. See control expressions
while
Creates a loop that executes while the condition is true. See control expressions
yield
Starts execution of the block sent to the current method. See methods

总共 42 个词。也就是说,编写 Ruby 程序时,只需要也只能使用这些英文词。编程过程中,除了这些英文词以外,还会出现的英文词就是 Ruby 内置的方法了。

1 只是具有字面意义的变量。

作者

发表时间

Gedit 是我在 Debian/Ubuntu 平台一直很喜欢用的编辑器。iBus 是我使用的输入法平台,ibus-libpinyin 是我主要使用的拼音输入。

Gedit 具备基本编辑器的功能,如果通过 Plugins 的加持,则威力瞬间提升。所以,可视化环境下,我都是使用该编辑器编写程序。

但是,从 Ubuntu 22.04 开始出现一个问题:当 Gedit 长时间(也不用多长时间)使用后,就会出现 iBus 死机(或者退出),中文输入不能使用。

经过搜索,据说该问题是 Gedit 的问题,因为 Ubuntu 从 22.10 开始启用新的文本编辑器(Text Editor)了,Gedit 将不再支持。

解决方案有两种,就是重启 iBus 输入法平台:

  1. 临时启动: ibus-daemon -rdx
  2. 终极解决: gsettings set org.gnome.desktop.interface gtk-im-module 'ibus'

另外,也试用了 Text Editor 一下,没有 Gedit 强大,平时用也够用。但是我还是喜欢使用 Gedit。

作者