Module: Onebox::Engine::ClassMethods

Defined in:
lib/onebox/engine.rb

Instance Method Summary collapse

Instance Method Details

#===(other) ⇒ Object



97
98
99
100
101
102
103
# File 'lib/onebox/engine.rb', line 97

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

#always_httpsObject



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

def always_https
  @https = true
end

#always_https?Boolean

Returns:

  • (Boolean)


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

def always_https?
  @https
end

#matches_regexp(r) ⇒ Object



109
110
111
# File 'lib/onebox/engine.rb', line 109

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

#onebox_nameObject

calculates a name for onebox using the class name of engine



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

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

#priorityObject



105
106
107
# File 'lib/onebox/engine.rb', line 105

def priority
  100
end