StdlibDoc::Status::Database::Record (Class)

In: StdlibDoc/Status/Database.rb
Parent: Object

Represents the things known about one file in the standard library. See the file-level documentation for an overview.

Methods

new  

Attributes

comment  [R] 
committed  [R] 
contributors  [R] 
loc  [R] 
owner  [R] 
path  [R] 
priority  [R] 
score  [R] 
status  [R] 

Public Class methods

[Source]

# File StdlibDoc/Status/Database.rb, line 94
    def initialize(hash)
      @path, @loc, @status      = hash.values_at("path", "loc", "status")
      @priority, @score, @owner = hash.values_at("priority", "score", "owner")
      @contributors, @committed = hash.values_at("contributors", "committed")
      @comment                  = hash.values_at("comment")
      
      # Turn the @loc keys into symbols.
      @loc = (@loc || {}).build_hash do |key, value|
        [ key.intern, value ]
      end

      # Turn @status and @priority into a symbol.
      @status   = @status && @status.intern
      @priority = @priority && @priority.intern

      # Turn @contributors into an array.
      @contributors = (@contributors || "").split

      # XXX: @comment is turning out to be an Array.  YAML format?  Here's a
      # workaround.
      @comment = @comment.join(" ") if @comment.is_a? Array
      @comment = @comment.gsub(/\n+/, " ").strip
    rescue => err
      message = %{
        Failed to create Record: #{err.message}
        #{err.backtrace}
      }.indent(0)
      raise DatabaseError, "Failed to create Record: #$!"
    end

[Validate]