Class: RageRender::ChapterDrop

Inherits:
Jekyll::Drops::DocumentDrop
  • Object
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
PAGINATION_FIELDS =
%w[ chaptername chapterdescription chapterid ]

Instance Method Summary collapse

Methods included from Pipettes

clean_payload, def_data_delegator, def_image_metadata, def_loop, extended, loops

Instance Method Details

#chapteridObject



87
88
89
# File 'lib/ragerender/jekyll/chapter.rb', line 87

def chapterid
  @obj.collection.docs.index @obj
end

#chapternameObject



91
92
93
# File 'lib/ragerender/jekyll/chapter.rb', line 91

def chaptername
  escape @obj.data['title']
end

#cover_height_smallObject



103
104
105
106
107
108
109
# File 'lib/ragerender/jekyll/chapter.rb', line 103

def cover_height_small
  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_smallObject



95
96
97
98
99
100
101
# File 'lib/ragerender/jekyll/chapter.rb', line 95

def cover_width_small
  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

#firstcomicinchapterObject



111
112
113
# File 'lib/ragerender/jekyll/chapter.rb', line 111

def firstcomicinchapter
  first_comic&.url
end

#to_liquidObject



115
116
117
118
119
# File 'lib/ragerender/jekyll/chapter.rb', line 115

def to_liquid
  super.reject do |k, v|
    Jekyll::Drops::DocumentDrop::NESTED_OBJECT_FIELD_BLACKLIST.include? k
  end.to_h
end