14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/tabulous/dsl/tabs.rb', line 14
def method_missing(method, *args, &block)
method_name = method.to_s
if method_name =~ /^(.+)_subtab/
if @parent_tab.nil?
raise SubtabOutOfOrderError, "You cannot start a tabs declaration with a subtab: '#{method_name}'."
end
tab = Dsl::Tab.process($1, @parent_tab, &block)
elsif method_name =~ /^(.+)_tab/
tab = Dsl::Tab.process($1, nil, &block)
@parent_tab = tab
else
raise TabNameError, "Incorrect tab name: '#{method_name}'. Tab names must end with _tab or _subtab."
end
@tabset.add_tab(tab)
end
|