Module: NoSE::Debug
- Defined in:
- lib/nose/debug.rb
Overview
Various helpful debugging snippets
Class Method Summary collapse
-
.break_on_indexes(*index_keys) ⇒ void
Convenience method to break in IndexLookupStep when a particular set of indexes is reach when planning.
-
.export_model(model) ⇒ void
Export entities in a model as global variales for easier access when debugging.
Class Method Details
.break_on_indexes(*index_keys) ⇒ void
This method returns an undefined value.
Convenience method to break in IndexLookupStep when a particular set of indexes is reach when planning
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/nose/debug.rb', line 17 def self.break_on_indexes(*index_keys) apply = binding.of_caller(1) parent = apply.eval 'parent' index = apply.eval 'index' current_keys = parent.parent_steps.indexes.map(&:key) << index.key # rubocop:disable Lint/Debugger binding.pry if current_keys == index_keys # rubocop:enable Lint/Debugger end |
.export_model(model) ⇒ void
This method returns an undefined value.
Export entities in a model as global variales for easier access when debugging
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/nose/debug.rb', line 31 def self.export_model(model) model.entities.each do |name, entity| # rubocop:disable Lint/Eval eval("$#{name} = entity") # rubocop:enable Lint/Eval entity.fields.merge(entity.foreign_keys).each do |field_name, field| entity.define_singleton_method field_name.to_sym, -> { field } end end nil end |