Module: Onebox::Engine::ClassMethods

Defined in:
lib/onebox/engine.rb

Instance Method Summary collapse

Instance Method Details

#===(other) ⇒ Object



105
106
107
108
109
110
111
# File 'lib/onebox/engine.rb', line 105

def ===(other)
  if other.kind_of?(URI)
    !!(other.to_s =~ class_variable_get(:@@matcher))
  else
    super
  end
end

#always_httpsObject



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

def always_https
  @https = true
end

#always_https?Boolean

Returns:

  • (Boolean)


138
139
140
# File 'lib/onebox/engine.rb', line 138

def always_https?
  @https
end

#iframe_originsObject



125
126
127
# File 'lib/onebox/engine.rb', line 125

def iframe_origins
  class_variable_defined?(:@@iframe_origins) ? class_variable_get(:@@iframe_origins) : []
end

#matches_regexp(r) ⇒ Object



117
118
119
# File 'lib/onebox/engine.rb', line 117

def matches_regexp(r)
  class_variable_set :@@matcher, r
end

#onebox_nameObject

calculates a name for onebox using the class name of engine



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

def onebox_name
  name.split("::").last.downcase.gsub(/onebox/, "")
end

#priorityObject



113
114
115
# File 'lib/onebox/engine.rb', line 113

def priority
  100
end

#requires_iframe_origins(*origins) ⇒ Object



121
122
123
# File 'lib/onebox/engine.rb', line 121

def requires_iframe_origins(*origins)
  class_variable_set :@@iframe_origins, origins
end