public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
remove pointless accessor methods for liquid drops

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@2356 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Tue Oct 10 10:03:41 -0700 2006
commit  30dd979891ea3c8aa8e536c6b34c045cbeb196df
tree    f17c315ef5b8925e2507b7c052d388f817e6a749
parent  d11d5c328764b3eeb7fb9607c1963d31ade4cb5b
...
4
5
6
7
8
9
10
11
...
34
35
36
37
 
38
39
40
41
 
42
43
44
...
4
5
6
 
 
7
8
9
...
32
33
34
 
35
36
37
38
 
39
40
41
42
0
@@ -4,8 +4,6 @@ class ArticleDrop < BaseDrop
0
   timezone_dates :published_at, :updated_at
0
   liquid_attributes << :title << :permalink << :comments_count
0
   
0
- def article() @source end
0
-
0
   def initialize(source, options = {})
0
     super source
0
     @options = options
0
@@ -34,11 +32,11 @@ class ArticleDrop < BaseDrop
0
   end
0
 
0
   def blog_sections
0
- sections.select { |s| s.section.blog? }
0
+ sections.select { |s| s.source.blog? }
0
   end
0
   
0
   def page_sections
0
- sections.select { |s| s.section.paged? }
0
+ sections.select { |s| s.source.paged? }
0
   end
0
   
0
   def content
...
1
2
3
4
5
6
...
1
2
 
3
4
5
0
@@ -1,6 +1,5 @@
0
 class AssetDrop < BaseDrop
0
   liquid_attributes.push(*[:content_type, :size, :filename, :width, :height])
0
- def asset() @source end
0
 
0
   [:image, :movie, :audio, :other, :pdf].each do |content|
0
     define_method("is_#{content}") { @source.send("#{content}?") }
...
4
5
6
7
8
9
10
11
12
 
13
14
15
16
17
 
 
18
19
20
...
22
23
24
25
 
26
27
28
...
4
5
6
 
 
7
8
9
 
10
11
12
13
 
 
14
15
16
17
18
...
20
21
22
 
23
24
25
26
0
@@ -4,17 +4,15 @@ class CommentDrop < BaseDrop
0
   
0
   timezone_dates :published_at, :created_at
0
   liquid_attributes.push(*[:author, :author_email, :author_ip, :title])
0
-
0
- def comment() @source end
0
 
0
   def initialize(source)
0
     super
0
- @liquid.update 'is_approved' => comment.approved?, 'body' => white_list(comment.body_html)
0
+ @liquid.update 'is_approved' => @source.approved?, 'body' => white_list(@source.body_html)
0
   end
0
   
0
   def author_url
0
- return nil if comment.author_url.blank?
0
- comment.author_url =~ /^https?:\/\// ? comment.author_url : "http://" + comment.author_url
0
+ return nil if source.author_url.blank?
0
+ @source.author_url =~ /^https?:\/\// ? @source.author_url : "http://" + @source.author_url
0
   end
0
 
0
   def url
0
@@ -22,6 +20,6 @@ class CommentDrop < BaseDrop
0
   end
0
 
0
   def author_link
0
- comment.author_url.blank? ? "<span>#{CGI::escapeHTML(comment.author)}</span>" : %Q{<a href="#{CGI::escapeHTML author_url}">#{CGI::escapeHTML comment.author}</a>}
0
+ @source.author_url.blank? ? "<span>#{CGI::escapeHTML(@source.author)}</span>" : %Q{<a href="#{CGI::escapeHTML author_url}">#{CGI::escapeHTML @source.author}</a>}
0
   end
0
 end
0
\ No newline at end of file
...
3
4
5
6
7
8
9
...
30
31
32
33
34
35
 
36
37
38
...
3
4
5
 
6
7
8
...
29
30
31
 
 
 
32
33
34
35
0
@@ -3,7 +3,6 @@ class SectionDrop < BaseDrop
0
   
0
   liquid_attributes.push(*[:name, :path, :archive_path])
0
   
0
- def section() @source end
0
   def current() @current == true end
0
 
0
   def initialize(source, current = false)
0
@@ -30,9 +29,7 @@ class SectionDrop < BaseDrop
0
   end
0
 
0
   def pages
0
- @pages ||= liquidize(*@source.articles) do |article, i|
0
- article.to_liquid(:page => i.zero?)
0
- end
0
+ @pages ||= liquidize(*@source.articles) { |article, i| article.to_liquid(:page => i.zero?) }
0
   end
0
 
0
   def url
...
1
2
3
4
5
6
...
52
53
54
55
 
56
57
58
59
 
60
61
62
...
1
2
 
3
4
5
...
51
52
53
 
54
55
56
57
 
58
59
60
61
0
@@ -1,6 +1,5 @@
0
 class SiteDrop < BaseDrop
0
   liquid_attributes.push(*[:host, :subtitle, :title, :articles_per_page, :tag_path, :search_path])
0
- def site() @source end
0
   def current_section() @current_section_liquid end
0
 
0
   def initialize(source, section = nil)
0
@@ -52,11 +51,11 @@ class SiteDrop < BaseDrop
0
   end
0
   
0
   def blog_sections
0
- sections.select { |s| s.section.blog? }
0
+ sections.select { |s| s.source.blog? }
0
   end
0
   
0
   def page_sections
0
- sections.select { |s| s.section.paged? }
0
+ sections.select { |s| s.source.paged? }
0
   end
0
   
0
   def tags
...
1
2
3
4
...
1
2
 
3
0
@@ -1,4 +1,3 @@
0
 class UserDrop < BaseDrop
0
   liquid_attributes << :login << :email
0
- def user() @source end
0
 end
...
19
20
21
22
 
23
24
25
...
28
29
30
31
 
32
33
34
35
 
36
37
38
...
19
20
21
 
22
23
24
25
...
28
29
30
 
31
32
33
34
 
35
36
37
38
0
@@ -19,7 +19,7 @@ class ArticleDropTest < Test::Unit::TestCase
0
   end
0
   
0
   def test_should_list_all_but_home_sections
0
- assert_equal [sections(:about)], @article.sections.collect(&:section)
0
+ assert_equal [sections(:about)], @article.sections.collect(&:source)
0
   end
0
   
0
   def test_should_list_tags
0
@@ -28,11 +28,11 @@ class ArticleDropTest < Test::Unit::TestCase
0
   
0
   def test_should_list_only_blog_sections
0
     sections(:home).update_attribute :path, 'foo'
0
- assert_equal [sections(:home)], @article.blog_sections.collect(&:section)
0
+ assert_equal [sections(:home)], @article.blog_sections.collect(&:source)
0
   end
0
   
0
   def test_should_list_only_paged_sections
0
- assert_equal [sections(:about)], @article.page_sections.collect(&:section)
0
+ assert_equal [sections(:about)], @article.page_sections.collect(&:source)
0
   end
0
 
0
   def test_empty_body
...
16
17
18
19
 
20
21
22
23
24
 
25
26
 
27
28
29
30
31
32
 
33
34
 
35
36
37
 
 
38
39
40
...
16
17
18
 
19
20
21
22
23
 
24
25
 
26
27
28
29
30
31
 
32
33
 
34
35
 
 
36
37
38
39
40
0
@@ -16,25 +16,25 @@ class CommentDropTest < Test::Unit::TestCase
0
   end
0
   
0
   def test_should_output_author_link_if_url_given
0
- @comment.comment.author_url = 'http://test'
0
+ @comment.source.author_url = 'http://test'
0
     assert_equal '<a href="http://test">rico</a>', @comment.author_link
0
   end
0
 
0
   def test_should_check_for_existance_of_author_url
0
- @comment.comment.author_url = nil
0
+ @comment.source.author_url = nil
0
     assert_nil @comment.author_url
0
- @comment.comment.author_url = ''
0
+ @comment.source.author_url = ''
0
     assert_nil @comment.author_url
0
   end
0
 
0
   def test_should_return_correct_author_link
0
     assert_equal '<span>rico</span>', @comment.author_link
0
- @comment.comment.author_url = 'abc'
0
+ @comment.source.author_url = 'abc'
0
     assert_equal %Q{<a href="http://abc">rico</a>}, @comment.author_link
0
- @comment.comment.author_url = 'https://abc'
0
+ @comment.source.author_url = 'https://abc'
0
     assert_equal %Q{<a href="https://abc">rico</a>}, @comment.author_link
0
- @comment.comment.author = '<strong>rico</strong>'
0
- @comment.comment.author_url = '<strong>https://abc</strong>'
0
+ @comment.source.author = '<strong>rico</strong>'
0
+ @comment.source.author_url = '<strong>https://abc</strong>'
0
     assert_equal %Q{<a href="http://&lt;strong&gt;https://abc&lt;/strong&gt;">&lt;strong&gt;rico&lt;/strong&gt;</a>}, @comment.author_link
0
   end
0
   
...
18
19
20
21
 
22
23
24
...
34
35
36
37
 
38
39
40
41
 
42
43
44
...
18
19
20
 
21
22
23
24
...
34
35
36
 
37
38
39
40
 
41
42
43
44
0
@@ -18,7 +18,7 @@ class SiteDropTest < Test::Unit::TestCase
0
   end
0
 
0
   def test_should_list_all_sections
0
- assert_models_equal [sections(:home), sections(:about), sections(:earth), sections(:europe), sections(:africa), sections(:bucharest), sections(:links)], @site.sections.collect(&:section)
0
+ assert_models_equal [sections(:home), sections(:about), sections(:earth), sections(:europe), sections(:africa), sections(:bucharest), sections(:links)], @site.sections.collect(&:source)
0
     assert_equal [false, false, false, false, false, false, false], @site.sections.collect(&:current)
0
   end
0
   
0
@@ -34,11 +34,11 @@ class SiteDropTest < Test::Unit::TestCase
0
   end
0
   
0
   def test_should_list_only_blog_sections
0
- assert_models_equal [sections(:home), sections(:earth), sections(:europe), sections(:africa), sections(:bucharest)], @site.blog_sections.collect(&:section)
0
+ assert_models_equal [sections(:home), sections(:earth), sections(:europe), sections(:africa), sections(:bucharest)], @site.blog_sections.collect(&:source)
0
   end
0
   
0
   def test_should_list_only_paged_sections
0
- assert_models_equal [sections(:about), sections(:links)], @site.page_sections.collect(&:section)
0
+ assert_models_equal [sections(:about), sections(:links)], @site.page_sections.collect(&:source)
0
   end
0
 
0
   def test_should_list_tags

Comments

    No one has commented yet.