Class: Hashformer::Generate::Chain::DebuggableReceiver

Inherits:
Object
  • Object
show all
Includes:
ReceiverMethods
Defined in:
lib/hashformer/generate.rb

Overview

Debuggable chain receiver that inherits from Object. This will break a lot of chains (e.g. any chain using #to_s or #inspect), but will allow some debugging tools to operate without crashing. See Hashformer::Generate::Chain.enable_debugging.

Instance Attribute Summary

Attributes included from ReceiverMethods

#__chain

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object

Overrides ReceiverMethods#method_missing to print out methods as they are added to the chain.



133
134
135
136
# File 'lib/hashformer/generate.rb', line 133

def method_missing(name, *args, &block)
  __dbg_msg(name, args, block)
  super
end

Instance Method Details

#__as(*args, &block) ⇒ Object

Overrides ReceiverMethods#__as to print out blocks as they are added to the chain.



140
141
142
143
# File 'lib/hashformer/generate.rb', line 140

def __as(*args, &block)
  __dbg_msg('__as', args, block)
  super
end

#__endObject

Overrides ReceiverMethods#__end to print a message when a chain is ended.



147
148
149
150
# File 'lib/hashformer/generate.rb', line 147

def __end
  $stdout.puts "Ending chain #{__id__}"
  super
end