Module: Onebox::Engine::ClassMethods

Defined in:
lib/onebox/engine.rb

Instance Method Summary collapse

Instance Method Details

#===(other) ⇒ Object



72
73
74
75
76
77
78
# File 'lib/onebox/engine.rb', line 72

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

#matches(&block) ⇒ Object



84
85
86
# File 'lib/onebox/engine.rb', line 84

def matches(&block)
  matches_regexp(Hexpress.new(&block).to_r)
end

#matches_regexp(r) ⇒ Object



88
89
90
# File 'lib/onebox/engine.rb', line 88

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

#onebox_nameObject

calculates a name for onebox using the class name of engine



93
94
95
# File 'lib/onebox/engine.rb', line 93

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

#priorityObject



80
81
82
# File 'lib/onebox/engine.rb', line 80

def priority
  100
end