Method: Truck::Autoloader#fetch_context_and_base_nibbles
- Defined in:
- lib/truck/autoloader.rb
#fetch_context_and_base_nibbles ⇒ Object
given “Foo::Bar::Baz”, return [“Foo::Bar::Baz”, “Foo::Bar”, etc.]
47 48 49 50 51 52 53 54 55 |
# File 'lib/truck/autoloader.rb', line 47 def fetch_context_and_base_nibbles each_base_nibble.to_a.reverse.reduce [] do |ary, (mod, const)| owner = Truck.contexts.each_value.detect { |c| c.mod == mod } return [owner, ary] if owner ary.map! do |e| e.insert 0, '::'; e.insert 0, const; end ary << const end nil end |