文章目录
  1. 1. 全局
  2. 2. 数组
  3. 3. 哈希表
  4. 4. Base64
  5. 5. File
  6. 6. FileUtils
  7. 7. Math

全局

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
ARGF: 从ARGV读取文件的流
ARGV: 传入程序的参数数组
PROGRAM_NAME: 被调用的程序名称
STDIN:
STDOUT:
STDERR:
``: 执行一个subshell
abort(message, status = 1) : NoReturn
at_exit(&handler : Int32, Exception? -> ) : Nil
caller
delay(delay, &block : -> UNDERSCORE)
exit(status = 0) : NoReturn
fork(&block)
future(&exp : -> UNDERSCORE)
gets(*args, **options)
lazy(&block : -> UNDERSCORE)
loop(&block)
main(argc : Int32, argv : Pointer(Pointer(UInt8)))
p(**objects)
p(object)
p(*objects)
pp(**objects)
pp(object)
print(*objects : UNDERSCORE) : Nil
printf(format_string, *args) : Nil
printf(format_string, args : Array | Tuple) : Nil
puts(*objects) : Nil
raise(exception : Exception) : NoReturn
raise(message : String) : NoReturn
rand(x)
rand
read_line(*args, **options)
sleep
sleep(time : Time::Span)
sleep(seconds : Number)
spawn(*, name : String? = nil, &block)
sprintf(format_string, *args) : String
sprintf(format_string, args : Array | Tuple) : String
system(command : String, args = nil) : Bool
with_color(color : Symbol)
with_color

数组

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#实例方法
#&(other : Array(U)) forall U
#*(times : Int)
#+(other : Array(U)) forall U
#-(other : Array(U)) forall U
#<<(value : T)
#<=>(other : Array)
#==(other : Array)
#[](start : Int, count : Int)
#[](range : Range)
#[]=(range : Range, value : T)
#[]=(range : Range, values : Array(T))
#[]=(index : Int, value : T)
#[]=(index : Int, count : Int, value : T)
#[]=(index : Int, count : Int, values : Array(T))
#[]?(start : Int, count : Int)
#[]?(range : Range(Int, Int))
#clear
#clone
#combinations(size : Int = self.size)
#compact
#compact!
#concat(other : Array)
#delete(obj)
#delete_at(index : Int, count : Int)
#delete_at(index : Int)
#delete_at(range : Range)
#fill(from : Int, &block)
#fill(range : Range, &block)
#fill(value : T, from : Int, count : Int)
#fill(value : T, range : Range)
#fill(value : T)
#first(n : Int)
#last(n : Int)
#map(&block : T -> U) forall U
#map!(&block)
#map_with_index(&block : T, Int32 -> U) forall U
#map_with_index!(&block : T, Int32 -> T)
#pop
#pop(&block)
#pop(n : Int)
#pop?
#push(value : T)
#push(*values : T)
#reject!(&block)
#reject!(pattern)
#replace(other : Array)
#reverse
#reverse!
#sample(n : Int, random = Random::DEFAULT)
#select!(pattern)
#select!(&block)
#shift
#shift(n : Int)
#shift(&block)
#shift?
#shuffle(random = Random::DEFAULT)
#shuffle!(random = Random::DEFAULT)
#size : Int32
#skip(count : Int) : Array(T)
#sort : Array(T)
#sort! : Array(T)
#sort_by!(&block : T -> UNDERSCORE) : Array(T)
#swap(index0, index1) : Array(T)
#to_json(json : JSON::Builder)
#to_a
#to_s(io : IO) : Nil
#uniq
#uniq(&block : T -> UNDERSCORE)
#uniq!
#uniq!(&block)
#unshift(obj : T)
#unshift(*values : T)
#update(index : Int, &block)
#|(other : Array(U)) forall U

从module Indexable(T)继承来的方法
[], []?, bsearch, bsearch_index, dig, dig?, each, each_index, empty?, equals?, fetch, first, first?, hash, index, join, last, last?, reverse_each, rindex, sample, size, to_a, unsafe_fetch, values_at

从module Enumerable(T)继承来的方法
all?, any?, chunks, compact_map, count, cycle, each, each_cons, each_slice, each_with_index, each_with_object, find, first, first?, flat_map, grep, group_by, in_groups_of, includes?, index, index_by, join, map, map_with_index, max, max?, max_by, max_by?, max_of, max_of?, min, min?, min_by, min_by?, min_of, min_of?, minmax, minmax?, minmax_by, minmax_by?, minmax_of, minmax_of?, none?, one?, partition, product, reduce, reject, select, size, skip, skip_while, sum, take_while, to_a, to_h, to_set, zip, zip?

从module Iterable(T)继承来的方法
chunk, chunk_while, cycle, each, each_cons, each_slice, each_with_index, each_with_object, slice_after, slice_before, slice_when

哈希表

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#类方法
.zip(ary1 : Array(K), ary2 : Array(V))

#实例方法
#==(other : Hash)
#[](key)
#[]=(key : K, value : V)
#[]?(key)
#clear
#clone
#compact
#compact!
#delete(key)
#delete(key, &block)
#delete_if(&block)
#dig(key : K, *subkeys)
#dig?(key : K, *subkeys)
#each(&block) : Nil
#each_key(&block)
#each_value(&block)
#empty?
#fetch(key, default)
#fetch(key, &block)
#first_key
#first_key?
#first_value
#first_value?
#has_key?(key)
#has_value?(val)
#hash(hasher)
#inspect(io : IO) : Nil
#key_for(value, &block)
#key_for(value)
#key_for?(value)
#key_index(key)
#keys
#last_key
#last_key?
#last_value
#last_value?
#merge(other : Hash(L, W)) forall L, W
#merge(other : Hash(L, W), &block : K, V, W -> V | W) forall L, W
#merge!(other : Hash, &block)
#merge!(other : Hash)
#reject(*keys)
#reject(&block : K, V -> UNDERSCORE)
#reject!(*keys)
#reject!(keys : Array | Tuple)
#reject!(&block : K, V -> UNDERSCORE)
#select(*keys)
#select(&block : K, V -> UNDERSCORE)
#select(keys : Array | Tuple)
#select!(keys : Array | Tuple)
#select!(&block : K, V -> UNDERSCORE)
#select!(*keys)
#shift
#shift(&block)
#shift?
#size : Int32
#to_s(io : IO) : Nil
#to_json(json : JSON::Builder)
#values
#values_at(*indexes : K)

Base64

1
2
3
#实例方法
#strict_encode(data) : String
#decode_string(data) : String

File

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#类方法
.basename(path, suffix) : String
.basename(path) : String
.chmod(path : Path | String, permissions : Int | Permissions)
.chown(path : Path | String, uid : Int = -1, gid : Int = -1, follow_symlinks = false)
.delete(path : Path | String)
.directory?(path : Path | String) : Bool
.dirname(path) : String
.each_line(filename, encoding = nil, invalid = nil, chomp = true, &block)
.empty?(path : Path | String) : Bool
.executable?(path : Path | String) : Bool
.exists?(path : Path | String) : Bool
.expand_path(path, dir = nil) : String
.extname(filename) : String
.file?(path : Path | String) : Bool
.info(path : Path | String, follow_symlinks = true) : Info
.info?(path : Path | String, follow_symlinks = true) : Info?
.join(parts : Array | Tuple) : String
.join(*parts : String | Path) : String
.link(old_path, new_path)
.match?(pattern : String, path : Path | String)
.open(filename : Path | String, mode = "r", perm = DEFAULT_CREATE_PERMISSIONS, encoding = nil, invalid = nil, &block)
.read(filename, encoding = nil, invalid = nil) : String
.read_lines(filename, encoding = nil, invalid = nil, chomp = true) : Array(String)
.readable?(path : Path | String) : Bool
.real_path(path) : String
.rename(old_filename, new_filename) : Nil
.same?(path1 : String, path2 : String, follow_symlinks = false) : Bool
.size(filename : Path | String) : UInt64
.symlink(old_path, new_path)
.symlink?(path) : Bool
.tempfile(prefix : String?, suffix : String?, *, dir : String = Dir.tempdir, encoding = nil, invalid = nil)
.tempfile(suffix : String? = nil, *, dir : String = Dir.tempdir, encoding = nil, invalid = nil)
.tempname(prefix : String?, suffix : String?, *, dir : String = Dir.tempdir)
.touch(filename : String, time : Time = Time.utc)
.utime(atime : Time, mtime : Time, filename : String) : Nil
.writable?(path : Path | String) : Bool
.write(filename, content, perm = DEFAULT_CREATE_PERMISSIONS, encoding = nil, invalid = nil, mode = "w")

FileUtils

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#实例方法
#cd(path : String)
#cd(path : String, &block)
#cmp(filename1 : String, filename2 : String)
#cmp(stream1 : IO, stream2 : IO)
#cp(src_path : String, dest : String)
#cp(srcs : Enumerable(String), dest : String)
#cp_r(src_path : String, dest_path : String)
#ln(src_path : String, dest_path : String)
#ln(src_paths : Enumerable(String), dest_dir : String)
#ln_s(src_path : String, dest_path : String)
#ln_s(src_paths : Enumerable(String), dest_dir : String)
#ln_sf(src_path : String, dest_path : String)
#ln_sf(src_paths : Enumerable(String), dest_dir : String)
#mkdir(paths : Enumerable(String), mode = 511) : Nil
#mkdir(path : String, mode = 511) : Nil
#mkdir_p(path : String, mode = 511) : Nil
#mkdir_p(paths : Enumerable(String), mode = 511) : Nil
#mv(src_path : String, dest_path : String) : Nil
#mv(srcs : Enumerable(String), dest : String) : Nil
#pwd : String
#rm(path : String) : Nil
#rm(paths : Enumerable(String)) : Nil
#rm_r(path : String) : Nil
#rm_r(paths : Enumerable(String)) : Nil
#rm_rf(path : String) : Nil
#rm_rf(paths : Enumerable(String)) : Nil
#rmdir(path : String) : Nil
#rmdir(paths : Enumerable(String)) : Nil
#touch(paths : Enumerable(String), time : Time = Time.utc)
#touch(path : String, time : Time = Time.utc)

Math

1
2


文章目录
  1. 1. 全局
  2. 2. 数组
  3. 3. 哈希表
  4. 4. Base64
  5. 5. File
  6. 6. FileUtils
  7. 7. Math