-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathimage.rb
52 lines (41 loc) · 1010 Bytes
/
image.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
41
42
43
44
45
46
47
48
49
50
51
52
module Photish
module Gallery
class Image
include Traits::Urlable
include Traits::Fileable
include Plugin::Pluginable
delegate :name,
:params,
to: :quality,
prefix: true,
allow_nil: true
delegate :url_info,
:config,
to: :parent,
allow_nil: true
attr_reader :path
def initialize(parent, path, quality)
super
@parent = parent
@path = path
@quality = quality
end
def name
@name ||= "#{basename_without_extension} #{quality_name}"
end
def plugin_type
Plugin::Type::Image
end
private
attr_reader :parent,
:quality
alias_method :base_url_name, :name
def url_end
@url_end ||= slugify("#{basename_without_extension}-#{quality_name}.#{extension}")
end
def base_url_name
'images'
end
end
end
end