Module: Onebox::Engine::ClassMethods
- Defined in:
- lib/onebox/engine.rb
Instance Method Summary collapse
- #===(other) ⇒ Object
- #always_https ⇒ Object
- #always_https? ⇒ Boolean
- #handles_content_type?(other) ⇒ Boolean
- #iframe_origins ⇒ Object
- #matches_content_type(ct) ⇒ Object
- #matches_regexp(r) ⇒ Object
-
#onebox_name ⇒ Object
calculates a name for onebox using the class name of engine.
- #priority ⇒ Object
- #requires_iframe_origins(*origins) ⇒ Object
Instance Method Details
#===(other) ⇒ Object
103 104 105 106 107 108 109 |
# File 'lib/onebox/engine.rb', line 103 def ===(other) if other.kind_of?(URI) !!(other.to_s =~ class_variable_get(:@@matcher)) else super end end |
#always_https ⇒ Object
136 137 138 |
# File 'lib/onebox/engine.rb', line 136 def always_https @https = true end |
#always_https? ⇒ Boolean
140 141 142 |
# File 'lib/onebox/engine.rb', line 140 def always_https? defined?(@https) ? @https : false end |
#handles_content_type?(other) ⇒ Boolean
97 98 99 100 101 |
# File 'lib/onebox/engine.rb', line 97 def handles_content_type?(other) if other && class_variable_defined?(:@@matcher_content_type) !!(other.to_s =~ class_variable_get(:@@matcher_content_type)) end end |
#iframe_origins ⇒ Object
127 128 129 |
# File 'lib/onebox/engine.rb', line 127 def iframe_origins class_variable_defined?(:@@iframe_origins) ? class_variable_get(:@@iframe_origins) : [] end |
#matches_content_type(ct) ⇒ Object
119 120 121 |
# File 'lib/onebox/engine.rb', line 119 def matches_content_type(ct) class_variable_set :@@matcher_content_type, ct end |
#matches_regexp(r) ⇒ Object
115 116 117 |
# File 'lib/onebox/engine.rb', line 115 def matches_regexp(r) class_variable_set :@@matcher, r end |
#onebox_name ⇒ Object
calculates a name for onebox using the class name of engine
132 133 134 |
# File 'lib/onebox/engine.rb', line 132 def onebox_name name.split("::").last.downcase.gsub(/onebox/, "") end |
#priority ⇒ Object
111 112 113 |
# File 'lib/onebox/engine.rb', line 111 def priority 100 end |
#requires_iframe_origins(*origins) ⇒ Object
123 124 125 |
# File 'lib/onebox/engine.rb', line 123 def requires_iframe_origins(*origins) class_variable_set :@@iframe_origins, origins end |