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 ]

Instance Method Summary collapse

Methods included from Pipettes

clean_payload, def_data_delegator, def_image_metadata, extended

Instance Method Details

#chapternameObject



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

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

#cover_height_smallObject



99
100
101
102
103
104
105
# File 'lib/ragerender/jekyll/chapter.rb', line 99

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



91
92
93
94
95
96
97
# File 'lib/ragerender/jekyll/chapter.rb', line 91

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



107
108
109
# File 'lib/ragerender/jekyll/chapter.rb', line 107

def firstcomicinchapter
  first_comic&.url
end

#to_liquidObject



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

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