Top Level Namespace

Defined Under Namespace

Modules: ActiveRecord, IncludableWithOptions, IoInterceptor, MyStuff, Net, RemoteDownload, ShellOut, SystemWithTweaks, TryBlock Classes: AndQ, BinaryQ, C, Exception, F, NonExistingException, NotQ, OrQ, Q, TestBlockTry, UnaryQ, User

Instance Method Summary collapse

Instance Method Details

#barObject



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

def bar; foo; end

#bazObject



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

def baz; foo; end

#F(attr_name) ⇒ Object



66
67
68
# File 'lib/dolzenko/django_f_object.rb', line 66

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

#f0Object

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



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

def f0() f1(); end

#f1Object



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

def f1() f2(); end

#f10Object



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

def f10() f11(); end

#f11Object



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

def f11() f12(); end

#f12Object



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

def f12() f13(); end

#f13Object



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

def f13() f14(); end

#f14Object



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

def f14() f15(); end

#f15Object



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

def f15() f16(); end

#f16Object



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

def f16() f17(); end

#f17Object



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

def f17() f18(); end

#f18Object



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

def f18() f19(); end

#f19Object



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

def f19() f20(); end

#f2Object



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

def f2() f3(); end

#f20Object

Raises:

  • (ArgumentError)


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

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

#f3Object



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

def f3() f4(); end

#f4Object



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

def f4() f5(); end

#f5Object



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

def f5() f6(); end

#f6Object



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

def f6() f7(); end

#f7Object



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

def f7() f8(); end

#f8Object



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

def f8() f9(); end

#f9Object



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

def f9() f10(); end

#fooObject



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

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



88
89
90
# File 'lib/dolzenko/django_q_object.rb', line 88

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

#raise_empty_messageObject

Raises:

  • (ArgumentError)


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

def raise_empty_message
  raise ArgumentError, ""
end

#raise_multilineObject



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

def raise_multiline
  raise "qwe\nasd\nzxc"
end

#raise_non_empty_messageObject

Raises:

  • (ArgumentError)


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

def raise_non_empty_message
  raise ArgumentError, "qwe"
end

#raise_normalObject

Helper



101
102
103
# File 'lib/dolzenko/error_print.rb', line 101

def raise_normal
  f10
end

#raise_runtime_emptyObject



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

def raise_runtime_empty
  raise
end

#raise_runtime_non_emptyObject

Raises:

  • (RuntimeError)


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

def raise_runtime_non_empty
  raise RuntimeError, "runtime non empty"
end

#raise_sys_stackObject



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

def raise_sys_stack
  baz
end

#ShellOut(*args) ⇒ Object



220
221
222
# File 'lib/dolzenko/shell_out.rb', line 220

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

#TryBlock(&block) ⇒ Object

Raises:

  • (ArgumentError)


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

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