Merge pull request #1927 from jekyll/delegate-silly

This commit is contained in:
Matt Rogers 2014-01-11 10:20:17 -08:00
commit d31efc7984
1 changed files with 8 additions and 6 deletions

View File

@ -1,10 +1,18 @@
require 'jekyll/convertible'
require 'forwardable'
module Jekyll module Jekyll
class Excerpt class Excerpt
include Convertible include Convertible
extend Forwardable
attr_accessor :post attr_accessor :post
attr_accessor :content, :output, :ext attr_accessor :content, :output, :ext
def_delegator :@post, :site, :site
def_delegator :@post, :name, :name
def_delegator :@post, :ext, :ext
# Initialize this Post instance. # Initialize this Post instance.
# #
# site - The Site. # site - The Site.
@ -17,12 +25,6 @@ module Jekyll
self.content = extract_excerpt(post.content) self.content = extract_excerpt(post.content)
end end
%w[site name ext].each do |meth|
define_method(meth) do
post.send(meth)
end
end
def to_liquid def to_liquid
post.to_liquid(Post::EXCERPT_ATTRIBUTES_FOR_LIQUID) post.to_liquid(Post::EXCERPT_ATTRIBUTES_FOR_LIQUID)
end end