Method: Filigree::Commands::ClassMethods#get_namespace
- Defined in:
- lib/filigree/commands.rb
#get_namespace(tokens, root: @commands) ⇒ Array<(Hash<Symbol, Hash>, Array<String>)>
Given a root namespace, find the namespace indicated by the provided tokens.
152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/filigree/commands.rb', line 152 def get_namespace(tokens, root: @commands) if tokens.empty? [root, tokens] else curr_token = tokens.first.to_sym if ns = root[curr_token] tokens.shift get_namespace(tokens, root: ns) else [root, tokens] end end end |