Class: RPaste::NoPaste::Metadata

Inherits:
Metadata
  • Object
show all
Includes:
Comparable
Defined in:
lib/rpaste/nopaste/metadata.rb

Instance Attribute Summary collapse

Attributes inherited from Metadata

#author, #name

Instance Method Summary collapse

Constructor Details

#initialize(name, author, date, syntax, description, &block) ⇒ Metadata

Creates a new NoPaste Metadata object with the specified name, author, date, syntax and description.


23
24
25
26
27
28
29
# File 'lib/rpaste/nopaste/metadata.rb', line 23

def initialize(name,author,date,syntax,description,&block)
  @date = Time.parse(date)
  @syntax = syntax
  @description = description

  super(name,author,&block)
end

Instance Attribute Details

#dateObject

Date of the paste


11
12
13
# File 'lib/rpaste/nopaste/metadata.rb', line 11

def date
  @date
end

#descriptionObject

Description of the paste


17
18
19
# File 'lib/rpaste/nopaste/metadata.rb', line 17

def description
  @description
end

#syntaxObject

Syntax of the paste text


14
15
16
# File 'lib/rpaste/nopaste/metadata.rb', line 14

def syntax
  @syntax
end

Instance Method Details

#<=>(other) ⇒ Object

Compare self to another NoPaste Metadata object based on their respective dates.


44
45
46
# File 'lib/rpaste/nopaste/metadata.rb', line 44

def <=>(other)
  @date <=> other.date
end

#paste(opts = {}) ⇒ Object

Returns the NoPaste Paste object associated with the Metadata object. If opts are given they will be used in accessing the NoPaste website.


36
37
38
# File 'lib/rpaste/nopaste/metadata.rb', line 36

def paste(opts={})
  Paste.paste(name,opts)
end