Class: Workarea::Content::Asset
Class Method Summary
collapse
Instance Method Summary
collapse
#add_subscription, #remove_subscription
included
#releasable?
add_worker, assert_valid_config!, async, caching_classes?, disable, enable, inline, #run_callbacks, workers, workers_list
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
129
130
131
132
133
134
135
|
# File 'app/models/workarea/content/asset.rb', line 129
def method_missing(sym, *args, &block)
if file.respond_to?(sym)
file.send(sym, *args, &block)
else
super
end
end
|
Class Method Details
.favicon_placeholder ⇒ Object
.favicons(type = nil) ⇒ Object
90
91
92
|
# File 'app/models/workarea/content/asset.rb', line 90
def self.favicons(type = nil)
tagged_with(['favicon', type].compact.join('-'))
end
|
.image_placeholder ⇒ Object
.open_graph_placeholder ⇒ Object
68
69
70
71
72
73
74
75
76
77
|
# File 'app/models/workarea/content/asset.rb', line 68
def self.open_graph_placeholder
find_by(file_name: Workarea.config.open_graph_placeholder_image_name)
rescue Mongoid::Errors::DocumentNotFound
create!(
file: FindPipelineAsset.new(
Workarea.config.open_graph_placeholder_image_name
).path
)
end
|
.placeholder ⇒ Object
49
50
51
52
53
54
55
|
# File 'app/models/workarea/content/asset.rb', line 49
def self.placeholder
warn <<~eos
[DEPRECATION] `Asset.placeholder` is deprecated and will be removed in
version 3.5.0. Please use `Asset.image_placeholder` instead.
eos
self.image_placeholder
end
|
Instance Method Details
#favicon? ⇒ Boolean
94
95
96
|
# File 'app/models/workarea/content/asset.rb', line 94
def favicon?
tags.any? { |t| t.starts_with?('favicon') }
end
|
#favicon_placeholder? ⇒ Boolean
115
116
117
|
# File 'app/models/workarea/content/asset.rb', line 115
def favicon_placeholder?
file_name == Workarea.config.favicon_placeholder_image_name
end
|
#image_placeholder? ⇒ Boolean
107
108
109
|
# File 'app/models/workarea/content/asset.rb', line 107
def image_placeholder?
file_name == Workarea.config.image_placeholder_image_name
end
|
#open_graph_placeholder? ⇒ Boolean
111
112
113
|
# File 'app/models/workarea/content/asset.rb', line 111
def open_graph_placeholder?
file_name == Workarea.config.open_graph_placeholder_image_name
end
|
#placeholder? ⇒ Boolean
99
100
101
102
103
104
105
|
# File 'app/models/workarea/content/asset.rb', line 99
def placeholder?
warn <<~eos
[DEPRECATION] `Asset#placeholder?` is deprecated and will be removed in
version 3.5.0. Please use `Asset#image_placeholder?` instead.
eos
image_placeholder?
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
125
126
127
|
# File 'app/models/workarea/content/asset.rb', line 125
def respond_to_missing?(method_name, include_private = false)
super || file.respond_to?(method_name)
end
|