Class: ObjectInspector

Inherits:
Object
  • Object
show all
Defined in:
lib/object_inspector.rb

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ ObjectInspector

Returns a new instance of ObjectInspector.



5
6
7
# File 'lib/object_inspector.rb', line 5

def initialize(obj)
  @obj = obj
end

Instance Method Details

#args_treeObject



13
14
15
# File 'lib/object_inspector.rb', line 13

def args_tree
  type_tree_for(@obj.class, {}, type_names)
end

#available_methodsObject



21
22
23
24
25
# File 'lib/object_inspector.rb', line 21

def available_methods
  @obj.constants.map { |c| 
    c.to_s.split("_args").first if c.to_s.end_with?("_args")
  }.compact
end

#response_mapObject



17
18
19
# File 'lib/object_inspector.rb', line 17

def response_map
  response_tree(@obj, {})
end

#sample_callObject



9
10
11
# File 'lib/object_inspector.rb', line 9

def sample_call
  type_tree_for(@obj.class, {}, sample_values)
end