Top Level Namespace
Defined Under Namespace
Modules: Enumerable, Kernel, Math Classes: Array, BigDecimal, Class, Complex, Dir, FalseClass, File, Hash, Method, NilClass, Numeric, Object, Panes, Rational, String, Symbol, Table, Time, TrueClass
Instance Method Summary collapse
-
#bp ⇒ Object
This is very stupid and shouldn’t be used in real code, which is why I will use it in real code.
- #bpe ⇒ Object
-
#require_local(lib_name, location = caller_locations.first.path) ⇒ Object
Copyright muflax <[email protected]>, 2013 License: GNU GPL 3 <www.gnu.org/copyleft/gpl.html>.
- #require_local_libs(path, location = __FILE__) ⇒ Object
- #stop_here ⇒ Object
- #v(*variables) ⇒ Object
-
#vivaHash(default = []) ⇒ Object
simple auto-vivifying hash TODO support nested hashes.
Instance Method Details
#bp ⇒ Object
This is very stupid and shouldn’t be used in real code, which is why I will use it in real code.
8 9 10 11 12 13 14 |
# File 'lib/muflax/debug.rb', line 8 def bp require "debug_inspector" require "pry" RubyVM::DebugInspector.open do |inspector| eval("binding.pry", inspector.frame_binding(2)) end end |
#bpe ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/muflax/debug.rb', line 16 def bpe require "debug_inspector" require "pry" RubyVM::DebugInspector.open do |inspector| eval("binding.pry; exit", inspector.frame_binding(2)) end end |
#require_local(lib_name, location = caller_locations.first.path) ⇒ Object
Copyright muflax <[email protected]>, 2013 License: GNU GPL 3 <www.gnu.org/copyleft/gpl.html>
6 7 8 9 10 11 12 13 |
# File 'lib/muflax/library.rb', line 6 def require_local lib_name, location=caller_locations.first.path file = File.symlink?(location) ? File.readlink(location) : location dir = File.dirname(file) lib = File.join(dir, "#{lib_name}.rb") raise "couldn't find local module: «#{lib_name}» in «#{dir}»" if not File.exists? lib require lib end |
#require_local_libs(path, location = __FILE__) ⇒ Object
21 22 23 24 25 |
# File 'lib/muflax.rb', line 21 def require_local_libs path, location=__FILE__ Dir["#{File.join(File.dirname(location), path)}/*.rb"].each do |lib| require lib end end |
#stop_here ⇒ Object
33 34 35 36 |
# File 'lib/muflax/debug.rb', line 33 def stop_here warn "[END OF DEBUG]" exit end |
#v(*variables) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/muflax/debug.rb', line 24 def v *variables require "debug_inspector" RubyVM::DebugInspector.open do |inspector| variables.each do |variable| eval("print '#{variable}: '; ap #{variable}", inspector.frame_binding(2)) end end end |