Module: Onebox::Engine::ClassMethods

Defined in:
lib/onebox/engine.rb

Instance Method Summary collapse

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_httpsObject



130
131
132
# File 'lib/onebox/engine.rb', line 130

def always_https
  @https = true
end

#always_https?Boolean

Returns:

  • (Boolean)


134
135
136
# File 'lib/onebox/engine.rb', line 134

def always_https?
  defined?(@https) ? @https : false
end

#iframe_originsObject



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_nameObject

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

#priorityObject



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