In Files

  • rdoc/ri/driver.rb

Parent

Files

Class/Module Index [+]

Quicksearch

RDoc::RI::Driver::OpenStructHash

This class offers both Hash and OpenStruct functionality. We convert from the Core Hash to this before calling any of the display methods, in order to give the display methods a cleaner API for accessing the data.

Public Class Methods

convert(object) click to toggle source

This method converts from a Hash to an OpenStructHash.

 
               # File rdoc/ri/driver.rb, line 24
def self.convert(object)
  case object
  when Hash then
    new_hash = new # Convert Hash -> OpenStructHash

    object.each do |key, value|
      new_hash[key] = convert(value)
    end

    new_hash
  when Array then
    object.map do |element|
      convert(element)
    end
  else
    object
  end
end
            

Public Instance Methods

merge_enums(other) click to toggle source
 
               # File rdoc/ri/driver.rb, line 43
def merge_enums(other)
  other.each do |k, v|
    if self[k] then
      case v
      when Array then
        # HACK dunno
        if String === self[k] and self[k].empty? then
          self[k] = v
        else
          self[k] += v
        end
      when Hash then
        self[k].update v
      else
        # do nothing
      end
    else
      self[k] = v
    end
  end
end
            
method_missing(method, *args) click to toggle source
 
               # File rdoc/ri/driver.rb, line 65
def method_missing method, *args
  self[method.to_s]
end