Module: Module::ModuleExtensions
- Included in:
- Module
- Defined in:
- lib/ruckus/extensions/module.rb
Instance Method Summary collapse
Instance Method Details
#flag_dump(i) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ruckus/extensions/module.rb', line 13 def flag_dump(i) # XXX not used @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
8 9 10 11 |
# File 'lib/ruckus/extensions/module.rb', line 8 def to_key_hash # XXX not used @key_hash ||= constants.map {|k| [const_get(k.intern), k.intern]}.to_hash end |
#to_name_hash ⇒ Object
3 4 5 6 |
# File 'lib/ruckus/extensions/module.rb', line 3 def to_name_hash # XXX not used @name_hash ||= constants.map {|k| [k.intern, const_get(k.intern)]}.to_hash end |