Module: Onebox::Engine::ClassMethods
- Defined in:
- lib/onebox/engine.rb
Instance Method Summary collapse
- #===(other) ⇒ Object
- #always_https ⇒ Object
- #always_https? ⇒ Boolean
- #iframe_origins ⇒ 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
101 102 103 104 105 106 107 |
# File 'lib/onebox/engine.rb', line 101 def ===(other) if other.kind_of?(URI) !!(other.to_s =~ class_variable_get(:@@matcher)) else super end end |
#always_https ⇒ Object
130 131 132 |
# File 'lib/onebox/engine.rb', line 130 def always_https @https = true end |
#always_https? ⇒ Boolean
134 135 136 |
# File 'lib/onebox/engine.rb', line 134 def always_https? defined?(@https) ? @https : false end |
#iframe_origins ⇒ Object
121 122 123 |
# File 'lib/onebox/engine.rb', line 121 def iframe_origins class_variable_defined?(:@@iframe_origins) ? class_variable_get(:@@iframe_origins) : [] end |
#matches_regexp(r) ⇒ Object
113 114 115 |
# File 'lib/onebox/engine.rb', line 113 def matches_regexp(r) class_variable_set :@@matcher, r end |
#onebox_name ⇒ Object
calculates a name for onebox using the class name of engine
126 127 128 |
# File 'lib/onebox/engine.rb', line 126 def onebox_name name.split("::").last.downcase.gsub(/onebox/, "") end |
#priority ⇒ Object
109 110 111 |
# File 'lib/onebox/engine.rb', line 109 def priority 100 end |
#requires_iframe_origins(*origins) ⇒ Object
117 118 119 |
# File 'lib/onebox/engine.rb', line 117 def requires_iframe_origins(*origins) class_variable_set :@@iframe_origins, origins end |