Module: Scrolls::Utils
- Included in:
- Log
- Defined in:
- lib/scrolls/utils.rb
Instance Method Summary collapse
Instance Method Details
#hashified_list(l) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/scrolls/utils.rb', line 12 def hashified_list(l) return {} if l.empty? l.inject({}) do |h, i| h[i.to_sym] = true h end end |
#hashify(d) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/scrolls/utils.rb', line 4 def hashify(d) last = d.pop return {} unless last return hashified_list(d).merge(last) if last.is_a?(Hash) d.push(last) hashified_list(d) end |