Class: Knish::DelegateInspector

Inherits:
Struct
  • Object
show all
Defined in:
lib/knish/delegate_inspector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes

Returns:

  • (Object)

    the current value of attributes



2
3
4
# File 'lib/knish/delegate_inspector.rb', line 2

def attributes
  @attributes
end

#objectObject

Returns the value of attribute object

Returns:

  • (Object)

    the current value of object



2
3
4
# File 'lib/knish/delegate_inspector.rb', line 2

def object
  @object
end

Instance Method Details

#mapped_attributesObject



11
12
13
14
15
# File 'lib/knish/delegate_inspector.rb', line 11

def mapped_attributes
  attributes.map do |attr|
    "@#{attr}=#{object.send(attr).inspect}"
  end
end

#memory_locationObject



7
8
9
# File 'lib/knish/delegate_inspector.rb', line 7

def memory_location
  '0x00%x' % (object.object_id << 1)
end

#to_inspectObject



3
4
5
# File 'lib/knish/delegate_inspector.rb', line 3

def to_inspect
  "#<#{object.class.name}:#{memory_location} #{mapped_attributes.join(' ')}>"
end