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.



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

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

#pasteObject

Returns the NoPaste Paste object associated with the Metadata object.



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

def paste
  Paste.paste(name)
end