Class: Module
Instance Method Summary collapse
Instance Method Details
#flag_dump(i) ⇒ Object
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/ragweed/utils.rb', line 165 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
161 162 163 |
# File 'lib/ragweed/utils.rb', line 161 def to_key_hash @key_hash ||= constants.map {|k| [const_get(k.intern), k.intern]}.to_hash end |
#to_name_hash ⇒ Object
157 158 159 |
# File 'lib/ragweed/utils.rb', line 157 def to_name_hash @name_hash ||= constants.map {|k| [k.intern, const_get(k.intern)]}.to_hash end |