Sha256: b471e34e800275bda79026fe707cb13b0ff94fa6722caec0a47cecf524ed7c86

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'rpaste/nopaste/paste'
require 'rpaste/metadata'

module RPaste
  module NoPaste
    class Metadata < RPaste::Metadata

      include Comparable

      # Date of the paste
      attr_accessor :date

      # Syntax of the paste text
      attr_accessor :syntax

      # Description of the paste
      attr_accessor :description

      #
      # Creates a new NoPaste Metadata object with the specified _name_,
      # _author_, _date_, _syntax_ and _description_.
      #
      def initialize(name,author,date,syntax,description,&block)
        @date = Time.parse(date)
        @syntax = syntax
        @description = description

        super(name,author,&block)
      end

      #
      # Returns the NoPaste Paste object associated with the Metadata
      # object. If _opts_ are given they will be used in accessing
      # the NoPaste website.
      #
      def paste(opts={})
        Paste.paste(name,opts)
      end

      #
      # Compare self to another NoPaste Metadata object based on their
      # respective dates.
      #
      def <=>(other)
        @date <=> other.date
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rpaste-0.0.9 lib/rpaste/nopaste/metadata.rb