Module: Cabin
- Defined in:
- lib/cabin/namespace.rb,
lib/cabin/inspectable.rb
Defined Under Namespace
Modules: Emitters, Inspectable, Metric, Mixins, Outputs, Publisher Classes: Channel, Context, Metrics, Subscriber, Timer
Class Method Summary collapse
Class Method Details
.__Inspectable(*ivars) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/cabin/inspectable.rb', line 39 def self.__Inspectable(*ivars) mod = Module.new mod.instance_eval do define_method(:inspect) do ivars = instance_variables if ivars.empty? str = "<#{self.class.name}(@#{self.object_id}) " ivars.each do |ivar| str << "#{ivar}=#{instance_variable_get(ivar).inspect} " end str << ">" return str end end return mod end |