Class: Dropdown::Post

Inherits:
Object
  • Object
show all
Defined in:
lib/dropdown/post.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, reader) ⇒ Post

Returns a new instance of Post.



29
30
31
32
# File 'lib/dropdown/post.rb', line 29

def initialize(source, reader)
  @source = source
  @reader = reader
end

Instance Attribute Details

#readerObject (readonly)

Returns the value of attribute reader.



3
4
5
# File 'lib/dropdown/post.rb', line 3

def reader
  @reader
end

#sourceObject (readonly)

Returns the value of attribute source.



3
4
5
# File 'lib/dropdown/post.rb', line 3

def source
  @source
end

Instance Method Details

#authorObject



9
10
11
# File 'lib/dropdown/post.rb', line 9

def author
  [:author]
end

#bodyObject



17
18
19
# File 'lib/dropdown/post.rb', line 17

def body
  content
end

#dateObject



13
14
15
# File 'lib/dropdown/post.rb', line 13

def date
  Date.parse [:date]
end

#excerptObject



21
22
23
24
25
26
27
# File 'lib/dropdown/post.rb', line 21

def excerpt
  unless @excerpt
    extractor = Dropdown::Parsers::ExcerptExtractor.new(content)
    @excerpt = extractor.extract
  end
  @excerpt
end

#titleObject



5
6
7
# File 'lib/dropdown/post.rb', line 5

def title
  [:title]
end