Class: BinderCore::Debug::Stack
- Inherits:
-
Object
- Object
- BinderCore::Debug::Stack
- Defined in:
- lib/binder_core/debug/stack.rb
Defined Under Namespace
Classes: Entry
Instance Attribute Summary collapse
-
#route ⇒ Object
readonly
Returns the value of attribute route.
Instance Method Summary collapse
- #add_file(route, file) ⇒ Object
-
#add_folder(route, folder) ⇒ Object
FIXME: it will not properly register the root file context and parser.
- #add_parser(route, parser) ⇒ Object
-
#initialize ⇒ Stack
constructor
A new instance of Stack.
- #trace ⇒ Object
Constructor Details
#initialize ⇒ Stack
Returns a new instance of Stack.
7 8 9 10 |
# File 'lib/binder_core/debug/stack.rb', line 7 def initialize @entry_hash = {} @route = [] end |
Instance Attribute Details
#route ⇒ Object
Returns the value of attribute route.
5 6 7 |
# File 'lib/binder_core/debug/stack.rb', line 5 def route @route end |
Instance Method Details
#add_file(route, file) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/binder_core/debug/stack.rb', line 21 def add_file(route,file) entry = create_entry route, file.file.path, file @entry_hash[route.join("~")] ||= [] @entry_hash[route.join("~")].insert 1, entry self.route = route entry end |
#add_folder(route, folder) ⇒ Object
FIXME: it will not properly register the root file context and parser
14 15 16 17 18 19 |
# File 'lib/binder_core/debug/stack.rb', line 14 def add_folder(route,folder) entry = create_entry route, folder.file.path, folder @entry_hash[route.join("~")] = [entry] self.route = route entry end |
#add_parser(route, parser) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/binder_core/debug/stack.rb', line 29 def add_parser(route,parser) entry = create_entry route, parser.file.path, parser @entry_hash[route.join("~")] ||= [] @entry_hash[route.join("~")].insert 2, entry self.route = route entry end |
#trace ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/binder_core/debug/stack.rb', line 37 def trace output = [] tmp = [] route.each do |step| tmp << step ky = tmp.join("~").to_s output.concat @entry_hash[ky] end output.reverse end |