mirror of
https://github.com/RubyMetric/chsrc
synced 2025-07-27 11:09:38 +08:00
Rename type
This commit is contained in:
parent
a6b0338ee0
commit
cefa25a883
@ -13,11 +13,11 @@
|
|||||||
unit module Parser;
|
unit module Parser;
|
||||||
|
|
||||||
#| 不能用 Bool,只能用 Boolean
|
#| 不能用 Bool,只能用 Boolean
|
||||||
my enum ConfigItemValueType <String Mode Boolean>;
|
my enum ConfigItem's-ValueType <String Mode Boolean>;
|
||||||
|
|
||||||
#| 配置项的值
|
#| 配置项的值
|
||||||
my class ConfigItemValue {
|
my class ConfigItem's-Value {
|
||||||
has ConfigItemValueType $.type;
|
has ConfigItem's-ValueType $.type;
|
||||||
has Str $.raw-value;
|
has Str $.raw-value;
|
||||||
has Any $.parsed-value;
|
has Any $.parsed-value;
|
||||||
|
|
||||||
@ -82,11 +82,11 @@ my class Config {
|
|||||||
# 如果非要在程序内部中调用,而不是直接从 Markdown 文件中读取出来
|
# 如果非要在程序内部中调用,而不是直接从 Markdown 文件中读取出来
|
||||||
# 一定要记得 $raw-value 用的是 rawstr4c 的语法!也就是说,这里一定是一个字符串
|
# 一定要记得 $raw-value 用的是 rawstr4c 的语法!也就是说,这里一定是一个字符串
|
||||||
method set($k, $raw-value) {
|
method set($k, $raw-value) {
|
||||||
%!items{$k} = ConfigItemValue.new($raw-value);
|
%!items{$k} = ConfigItem's-Value.new($raw-value);
|
||||||
}
|
}
|
||||||
|
|
||||||
method get($k, $default = Nil) {
|
method get($k, $default = Nil) {
|
||||||
return %!items{$k} // ($default ?? ConfigItemValue.new($default) !! ConfigItemValue.new(''));
|
return %!items{$k} // ($default ?? ConfigItem's-Value.new($default) !! ConfigItem's-Value.new(''));
|
||||||
}
|
}
|
||||||
|
|
||||||
method exist($k) {
|
method exist($k) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user