class Hermaeus::Apocryphon

Public: Data structure describing a Compendium entry.

Public Class Methods

new(data) click to toggle source

Public: Constructs an Apocryphon from reddit data responses.

data - A Hash emitted by Client#get_posts

# File lib/hermaeus/apocryphon.rb, line 7
def initialize data
        @data = data
end

Public Instance Methods

html() click to toggle source

Public: Accessor for the Apocryphon's HTML as compiled by reddit.

# File lib/hermaeus/apocryphon.rb, line 29
def html
        data[:selftext_html]
end
method_missing(name, *args, &block) click to toggle source

Public: Permit method-style access to the underlying data Hash's keys.

# File lib/hermaeus/apocryphon.rb, line 19
def method_missing name, *args, &block
        @data[name.to_sym]
end
text() click to toggle source

Public: Accessor for the Apocryphon's Markdown text.

# File lib/hermaeus/apocryphon.rb, line 24
def text
        @data[:selftext]
end
to_s() click to toggle source

Public: Serializes the Apocryphon item to a string.

Returns a String containing the title and author.

# File lib/hermaeus/apocryphon.rb, line 14
def to_s
        "#{self.title} – by #{self.author}"
end