Top Level Namespace

Defined Under Namespace

Modules: ActiveRecord, Dolzenko, Dummy, IncludableWithOptions, IoInterceptor, Kernel, MyStuff, Net, NeverTooDry, SafeInterpolate, ShellOut, SystemWithTweaks, TryBlock Classes: AndQ, BinaryQ, C, Class, Exception, F, Module, NilClass, NonExistingException, NotQ, Object, OrQ, Q, TestBlockTry, UnaryQ, User

Instance Method Summary collapse

Instance Method Details

#barObject



159
# File 'lib/dolzenko/error_print.rb', line 159

def bar; foo; end

#bazObject



159
# File 'lib/dolzenko/error_print.rb', line 159

def baz; foo; end

#F(attr_name) ⇒ Object



69
70
71
# File 'lib/dolzenko/django_f_object.rb', line 69

def F(attr_name)
  F.new(attr_name)
end

#f0Object

puts (0..20).map { |i| “def f#i() f#i+1(); end”}.join(“n”)



134
# File 'lib/dolzenko/error_print.rb', line 134

def f0() f1(); end

#f1Object



135
# File 'lib/dolzenko/error_print.rb', line 135

def f1() f2(); end

#f10Object



144
# File 'lib/dolzenko/error_print.rb', line 144

def f10() f11(); end

#f11Object



145
# File 'lib/dolzenko/error_print.rb', line 145

def f11() f12(); end

#f12Object



146
# File 'lib/dolzenko/error_print.rb', line 146

def f12() f13(); end

#f13Object



147
# File 'lib/dolzenko/error_print.rb', line 147

def f13() f14(); end

#f14Object



148
# File 'lib/dolzenko/error_print.rb', line 148

def f14() f15(); end

#f15Object



149
# File 'lib/dolzenko/error_print.rb', line 149

def f15() f16(); end

#f16Object



150
# File 'lib/dolzenko/error_print.rb', line 150

def f16() f17(); end

#f17Object



151
# File 'lib/dolzenko/error_print.rb', line 151

def f17() f18(); end

#f18Object



152
# File 'lib/dolzenko/error_print.rb', line 152

def f18() f19(); end

#f19Object



153
# File 'lib/dolzenko/error_print.rb', line 153

def f19() f20(); end

#f2Object



136
# File 'lib/dolzenko/error_print.rb', line 136

def f2() f3(); end

#f20Object

Raises:

  • (ArgumentError)


154
155
156
# File 'lib/dolzenko/error_print.rb', line 154

def f20
  raise(ArgumentError, "multi\nline\nerror")
end

#f3Object



137
# File 'lib/dolzenko/error_print.rb', line 137

def f3() f4(); end

#f4Object



138
# File 'lib/dolzenko/error_print.rb', line 138

def f4() f5(); end

#f5Object



139
# File 'lib/dolzenko/error_print.rb', line 139

def f5() f6(); end

#f6Object



140
# File 'lib/dolzenko/error_print.rb', line 140

def f6() f7(); end

#f7Object



141
# File 'lib/dolzenko/error_print.rb', line 141

def f7() f8(); end

#f8Object



142
# File 'lib/dolzenko/error_print.rb', line 142

def f8() f9(); end

#f9Object



143
# File 'lib/dolzenko/error_print.rb', line 143

def f9() f10(); end

#fooObject



159
# File 'lib/dolzenko/error_print.rb', line 159

def foo; bar; end

#IncludableWithOptions(options = {}) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/dolzenko/includable_with_options.rb', line 33

def IncludableWithOptions(options = {})
  m = Kernel.const_get(:IncludableWithOptions).dup
  # Because of Ruby bug (?) model function +included+ won't be able to access @@default_options:
  # http://redmine.ruby-lang.org/issues/show/3080
  # m.send(:class_variable_set, :@@default_options, options[:default])
  IncludableWithOptions.last_default_options = options[:default] 
  m
end

#Q(*args) ⇒ Object



91
92
93
# File 'lib/dolzenko/django_q_object.rb', line 91

def Q(*args)
  UnaryQ.new(*args)
end

#raise_empty_messageObject

Raises:

  • (ArgumentError)


113
114
115
# File 'lib/dolzenko/error_print.rb', line 113

def raise_empty_message
  raise ArgumentError, ""
end

#raise_multilineObject



109
110
111
# File 'lib/dolzenko/error_print.rb', line 109

def raise_multiline
  raise "qwe\nasd\nzxc"
end

#raise_non_empty_messageObject

Raises:

  • (ArgumentError)


117
118
119
# File 'lib/dolzenko/error_print.rb', line 117

def raise_non_empty_message
  raise ArgumentError, "qwe"
end

#raise_normalObject

Helper



105
106
107
# File 'lib/dolzenko/error_print.rb', line 105

def raise_normal
  f10
end

#raise_runtime_emptyObject



121
122
123
# File 'lib/dolzenko/error_print.rb', line 121

def raise_runtime_empty
  raise
end

#raise_runtime_non_emptyObject

Raises:

  • (RuntimeError)


125
126
127
# File 'lib/dolzenko/error_print.rb', line 125

def raise_runtime_non_empty
  raise RuntimeError, "runtime non empty"
end

#raise_sys_stackObject



129
130
131
# File 'lib/dolzenko/error_print.rb', line 129

def raise_sys_stack
  baz
end

#ShellOut(*args) ⇒ Object



254
255
256
# File 'lib/dolzenko/shell_out.rb', line 254

def ShellOut(*args)
  ShellOut.shell_out(*args)
end

#TryBlock(&block) ⇒ Object

Raises:

  • (ArgumentError)


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/dolzenko/try_block.rb', line 36

def TryBlock(&block)
  raise ArgumentError, "should be given block" unless block

  return if self.nil?

  caller_size = caller.size

  # JRuby reports this weird ":1" line in caller
  if RUBY_PLATFORM =~ /\bjava\b/ && caller[-1] == ":1"
    caller_size -= 1
  end

  begin
    yield
  rescue NoMethodError => e
    if e.backtrace.size - caller_size == 2 &&
            e.message =~ /^undefined method.+for nil:NilClass$/
      return nil
    end
    raise
  end
end