Class: Module
Instance Method Summary collapse
Instance Method Details
#flag_dump(i) ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/ragweed/utils.rb', line 166 def flag_dump(i) @bit_map ||= constants.map do |k| [k, const_get(k.intern).ffs] end.sort {|x, y| x[1] <=> y[1]} last = 0 r = "" @bit_map.each do |tup| if((v = (tup[1] - last)) > 1) r << ("." * (v-1)) end if((i & (1 << tup[1])) != 0) r << tup[0][0].chr else r << tup[0][0].chr.downcase end last = tup[1] end return r.reverse end |
#to_key_hash ⇒ Object
162 163 164 |
# File 'lib/ragweed/utils.rb', line 162 def to_key_hash @key_hash ||= constants.map {|k| [const_get(k.intern), k.intern]}.to_hash end |
#to_name_hash ⇒ Object
158 159 160 |
# File 'lib/ragweed/utils.rb', line 158 def to_name_hash @name_hash ||= constants.map {|k| [k.intern, const_get(k.intern)]}.to_hash end |