Class: VR::ObjectInspector::VariablesListView
- Defined in:
- lib/oinspect/VariablesListView.rb
Overview
Listview that holds variables in the ObjectInspectorGUI
Instance Attribute Summary
Attributes included from ViewCommon
#column_keys, #vr_cols, #vr_column, #vr_id, #vr_renderer
Instance Method Summary collapse
-
#initialize(obj) ⇒ VariablesListView
constructor
A new instance of VariablesListView.
Methods inherited from ListView
#[], #add_active_record_rows, #add_row, #select_row
Methods included from ViewCommon
#add_column, #add_renderer_to_col, #col_attr, #column, #delete_selected, #each_cell_method, #each_renderer, #each_row, #flatten_hash, #get_iter, #id, #method_missing, #ren_attr, #renderer, #selected_rows, #turn_on_comboboxes, #vr_row
Constructor Details
#initialize(obj) ⇒ VariablesListView
Returns a new instance of VariablesListView
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/oinspect/VariablesListView.rb', line 5 def initialize(obj) super(variable: String, type: String, class: String, value: String, obj: Object) obj.instance_variables.each do |var| row = add_row row[:variable] = var.to_s row[:class] = obj.instance_variable_get(var).class.name row[:value] = obj.instance_variable_get(var).to_s row[:type] = "var" row[:obj] = obj.instance_variable_get(var) end if obj.is_a?(Hash) obj.each do |key, val| row = add_row row[:variable] = key.to_s row[:class] = val.class.name row[:value] = val.to_s row[:type] = "key" row[:obj] = val end end if obj.is_a?(Array) obj.each_index do |i| row = add_row row[:variable] = i.to_s row[:class] = obj[i].class.name row[:value] = obj[i].to_s row[:type] = "index" row[:obj] = obj[i] end end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class VR::ViewCommon