Class: Naught::NullClassBuilder::Commands::Traceable
- Inherits:
-
Naught::NullClassBuilder::Command
- Object
- Naught::NullClassBuilder::Command
- Naught::NullClassBuilder::Commands::Traceable
- Defined in:
- lib/naught/null_class_builder/commands/traceable.rb
Instance Attribute Summary
Attributes inherited from Naught::NullClassBuilder::Command
Instance Method Summary collapse
Methods inherited from Naught::NullClassBuilder::Command
Constructor Details
This class inherits a constructor from Naught::NullClassBuilder::Command
Instance Method Details
#call ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/naught/null_class_builder/commands/traceable.rb', line 7 def call defer do |subject| subject.module_eval do attr_reader :__file__, :__line__ def initialize( = {}) range = (RUBY_VERSION.to_f == 1.9 && RUBY_PLATFORM != 'java') ? 4 : 3 backtrace = .fetch(:caller) { Kernel.caller(range) } @__file__, line = backtrace[0].split(':') @__line__ = line.to_i end end end end |