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
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus