Module: Kernel

Defined in:
lib/toffee/d.rb

Overview

Copyright © 2010 Jan Lelis

Instance Method Summary collapse

Instance Method Details

#d(*args) ⇒ Object

TODO: check, if there is already a method named d show a warning in that case!



12
13
14
15
16
17
18
19
20
21
# File 'lib/toffee/d.rb', line 12

def d(*args)
  if args.empty?
    tap do
      Toffee.output(block_given? ? yield(self) : self.inspect)
    end
  else
    raise ArgumentError, "Toffee: .d - The parser thought that the code after .d are method arguments... Please don't put a space after d or use .d() or .d{} in this case!"
#      eval ...
  end
end