Class RCAP::CAP_1_0::Resource

  1. lib/rcap/cap_1_0/resource.rb
Parent: Object

A Resource object is valid if

  • it has a resource description

Methods

public class

  1. new

public instance

  1. size_in_kb
  2. to_s

Included modules

  1. Validation

Attributes

digest [RW] SHA-1 hash of contents of resource
mime_type [RW]
resource_desc [RW] Resource Description
size [RW] Expressed in bytes
uri [RW] Resource location

Public class methods

new ( attributes = {} )
[show source]
# File lib/rcap/cap_1_0/resource.rb, line 35
      def initialize( attributes = {} )
        @mime_type     = attributes[ :mime_type ]
        @size          = attributes[ :size ]
        @uri           = attributes[ :uri ]
        @digest        = attributes[ :digest ]
        @resource_desc = attributes[ :resource_desc ]
      end

Public instance methods

size_in_kb ()

If size is defined returns the size in kilobytes

[show source]
# File lib/rcap/cap_1_0/resource.rb, line 54
      def size_in_kb
        if self.size
          self.size.to_f/1024
        end
      end
to_s ()

Returns a string representation of the resource of the form

resource_desc
[show source]
# File lib/rcap/cap_1_0/resource.rb, line 70
      def to_s
        self.resource_desc
      end