Debian Codegraph @

storage/mroonga/vendor/groonga/lib/mrb/scripts/query_logger/flag.rb

raw
1 module Groonga
2 class QueryLogger
3 class Flag
4 @@names = {}
5 class << self
6 def find(name)
7 @@names[name]
8 end
9 end
10
11 attr_reader :name
12 def initialize(name, flag)
13 @@names[name] = self
14 @name = name
15 @flag = flag
16 end
17
18 def to_i
19 @flag
20 end
21
22 NONE = new(:none, 0x00)
23 COMMAND = new(:command, 0x01 << 0)
24 RESULT_CODE = new(:result_code, 0x01 << 1)
25 DESTINATION = new(:destination, 0x01 << 2)
26 CACHE = new(:cache, 0x01 << 3)
27 SIZE = new(:size, 0x01 << 4)
28 SCORE = new(:score, 0x01 << 5)
29
30 all_flags = COMMAND.to_i |
31 RESULT_CODE.to_i |
32 DESTINATION.to_i |
33 CACHE.to_i |
34 SIZE.to_i |
35 SCORE.to_i
36 ALL = new(:all, all_flags)
37 end
38 end
39 end