class Object

Constants

AbstractDictionary
AbstractException
DBEHalt
Dictionary

Redefine primitives to simulate late binding

IdentityKeyValueDictionary
StringKeyValueDictionary

Public Instance Methods

__basetype() click to toggle source
# File lib/mdbe/database_views/object.rb, line 2
def __basetype
  :object
end
__evaluate_smalltalk(code) click to toggle source
# File lib/mdbe/database_views/object.rb, line 63
def __evaluate_smalltalk(code)
  code.__evaluate_smalltalk_in_context(self)
end
custom_database_tabs() click to toggle source
# File lib/mdbe/database_views/object.rb, line 6
def custom_database_tabs
  # [["Demo Tab", "demoData", "html with: 'This is an example'."]]
  []
end
to_database_view(orig_depth, ranges = {}, params = {}) click to toggle source
# File lib/mdbe/database_views/object.rb, line 11
def to_database_view(orig_depth, ranges = {}, params = {})
  obj = {:oop => self.object_id}

  depth = param_modify_depth(orig_depth, ranges, params)

  if depth > 0
    obj[:loaded] = true
    obj[:exception] = false
    obj[:classObject] = self.class.to_database_view(depth - 1, {}, params)
    obj[:virtualClassObject] = self.__virtual_class.to_database_view(depth - 1, {}, params)   # singleton class

    obj[:instVars] = {}
    obj[:instVarsSize] = 0

    if depth == 2
      obj[:customTabs] = self.custom_database_tabs
    else
      obj[:customTabs] = []
    end

    if render_inst_vars
      index = 1
      range_from = ranges[:instVars] ? Integer(ranges[:instVars][0]) : 1
      range_to = ranges[:instVars] ? Integer(ranges[:instVars][1]) : 10

      obj[:instVarsSize] = self.instance_variables.size

      ((range_from - 1)..[range_to - 1, self.instance_variables.size - 1].min).each do |index|
        begin
          obj[:instVars][index + 1] = [self.instance_variables[index].to_database_view(depth - 1, {}, params), self.instance_variable_get(self.instance_variables[index]).to_database_view(depth - 1, {}, params)]
        rescue Exception => e
          obj[:instVars][index + 1] = [self.instance_variables[index].to_database_view(depth - 1, {}, params), "(error)".to_database_view(1, {}, params)]
        end
      end
    end
  else
    obj[:loaded] = false
  end

  inspection = self.inspect
  if inspection._isString
    obj[:inspection] = inspection[0, 200]
    obj[:inspection] += "..." if obj[:inspection].size < inspection.size
  else
    obj[:inspection] = "(error)"
  end

  obj[:basetype] = __basetype

  return obj
end

Protected Instance Methods

render_inst_vars() click to toggle source
# File lib/mdbe/database_views/object.rb, line 71
def render_inst_vars
  true
end

Private Instance Methods

param_modify_depth(depth, ranges, params) click to toggle source
# File lib/mdbe/database_views/object.rb, line 77
def param_modify_depth(depth, ranges, params)
  depth
end