Module: Fortitude::Erector
- Defined in:
- lib/fortitude/erector.rb
Defined Under Namespace
Modules: ErectorAbstractWidgetOverrides
Classes: ErectorOutputBufferHolder
Class Method Summary
collapse
Class Method Details
36
37
38
|
# File 'lib/fortitude/erector.rb', line 36
def erector_widget_base_class_if_available
::Erector::Widget if is_erector_available?
end
|
.is_erector_available? ⇒ Boolean
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/fortitude/erector.rb', line 6
def is_erector_available?
@is_erector_available ||= begin
%w{erector-rails4 erector}.each do |gem_name|
begin
gem gem_name
rescue Gem::LoadError => le
end
end
begin
require 'erector'
rescue LoadError => le
end
if defined?(::Erector::Widget) then :yes else :no end
end
@is_erector_available == :yes
end
|
40
41
42
|
# File 'lib/fortitude/erector.rb', line 40
def is_erector_widget?(widget)
is_erector_widget_class?(widget.class)
end
|
28
29
30
31
32
33
34
|
# File 'lib/fortitude/erector.rb', line 28
def is_erector_widget_class?(widget_class)
return false unless is_erector_available?
return false unless widget_class.kind_of?(::Class)
return true if widget_class == ::Erector::Widget
return false if widget_class == ::Object
return is_erector_widget_class?(widget_class.superclass)
end
|