Module: Kernel

Defined in:
lib/hobo_support/module.rb,
lib/hobo_support.rb,
lib/hobo_support/methodphitamine.rb

Overview

classy_module lets you extract code from classes into modules, but still write it the same way

Instance Method Summary collapse

Instance Method Details

#classy_module(mod = Module.new, &b) ⇒ Object



87
88
89
90
91
92
# File 'lib/hobo_support/module.rb', line 87

def classy_module(mod=Module.new, &b)
  mod.meta_def :included do |base|
    base.class_eval &b
  end
  mod
end

#dbg(*args) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/hobo_support.rb', line 45

def dbg(*args)
  puts "---DEBUG---"
  args.each do |a|
    if a.is_a?(String) && a =~ /\n/
      puts %("""\n) + a + %(\n"""\n)
    else
      p a
    end
  end
  puts "-----------"
  args.first
end

#itObject Also known as: its



7
# File 'lib/hobo_support/methodphitamine.rb', line 7

def it() It.new end