Class: RageRender::ChapterDrop
- Inherits:
-
Jekyll::Drops::DocumentDrop
- Object
- Jekyll::Drops::DocumentDrop
- RageRender::ChapterDrop
show all
- Extended by:
- Forwardable, Pipettes
- Defined in:
- lib/ragerender/jekyll/chapter.rb
Overview
Values to pass to the archive layout when rendering a chapter.
Constant Summary
collapse
- COVER_MAX_HEIGHT =
420
- COVER_MAX_WIDTH =
300
%w[ chaptername chapterdescription chapterid ]
Instance Method Summary
collapse
Methods included from Pipettes
clean_payload, def_data_delegator, def_image_metadata, def_loop, def_safe_delegator, extended, loops
Instance Method Details
#chapterid ⇒ Object
86
87
88
|
# File 'lib/ragerender/jekyll/chapter.rb', line 86
def chapterid
@obj.collection.docs.index @obj
end
|
#chaptername ⇒ Object
90
91
92
|
# File 'lib/ragerender/jekyll/chapter.rb', line 90
def chaptername
escape @obj.data['title']
end
|
#cover_height_small ⇒ Object
104
105
106
107
108
109
110
111
112
|
# File 'lib/ragerender/jekyll/chapter.rb', line 104
def cover_height_small
return nil if cover_height.nil?
if (cover_height.to_f / COVER_MAX_HEIGHT) > (cover_width.to_f / COVER_MAX_WIDTH)
[COVER_MAX_HEIGHT, cover_height].min
else
(cover_width_small * cover_height) / cover_width
end
end
|
#cover_width_small ⇒ Object
94
95
96
97
98
99
100
101
102
|
# File 'lib/ragerender/jekyll/chapter.rb', line 94
def cover_width_small
return nil if cover_width.nil?
if (cover_height.to_f / COVER_MAX_HEIGHT) > (cover_width.to_f / COVER_MAX_WIDTH)
(cover_height_small * cover_width) / cover_height
else
[COVER_MAX_WIDTH, cover_width].min
end
end
|
#firstcomicinchapter ⇒ Object
114
115
116
|
# File 'lib/ragerender/jekyll/chapter.rb', line 114
def firstcomicinchapter
first_comic&.url
end
|
#to_liquid ⇒ Object
118
119
120
121
122
|
# File 'lib/ragerender/jekyll/chapter.rb', line 118
def to_liquid
super.reject do |k, v|
Jekyll::Drops::DocumentDrop::NESTED_OBJECT_FIELD_BLACKLIST.include? k
end.to_h
end
|