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
#embedded_children
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
116
117
118
119
120
121
122
|
# File 'app/models/workarea/content/asset.rb', line 116
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
82
83
84
|
# File 'app/models/workarea/content/asset.rb', line 82
def self.favicons(type = nil)
tagged_with(['favicon', type].compact.join('-'))
end
|
.image_placeholder ⇒ Object
.open_graph_default ⇒ Object
86
87
88
|
# File 'app/models/workarea/content/asset.rb', line 86
def self.open_graph_default
tagged_with('og-default').first
end
|
.open_graph_placeholder ⇒ Object
60
61
62
63
64
65
66
67
68
69
|
# File 'app/models/workarea/content/asset.rb', line 60
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
|
Instance Method Details
#favicon? ⇒ Boolean
90
91
92
|
# File 'app/models/workarea/content/asset.rb', line 90
def favicon?
tags.any? { |t| t.starts_with?('favicon') }
end
|
#favicon_placeholder? ⇒ Boolean
102
103
104
|
# File 'app/models/workarea/content/asset.rb', line 102
def favicon_placeholder?
file_name == Workarea.config.favicon_placeholder_image_name
end
|
#image_placeholder? ⇒ Boolean
94
95
96
|
# File 'app/models/workarea/content/asset.rb', line 94
def image_placeholder?
file_name == Workarea.config.image_placeholder_image_name
end
|
#open_graph_placeholder? ⇒ Boolean
98
99
100
|
# File 'app/models/workarea/content/asset.rb', line 98
def open_graph_placeholder?
file_name == Workarea.config.open_graph_placeholder_image_name
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
112
113
114
|
# File 'app/models/workarea/content/asset.rb', line 112
def respond_to_missing?(method_name, include_private = false)
super || file.respond_to?(method_name)
end
|