Class: Refinery::Pages::Tab

Inherits:
Object
  • Object
show all
Defined in:
lib/refinery/pages/tab.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name.



17
18
19
# File 'lib/refinery/pages/tab.rb', line 17

def name
  @name
end

#partialObject

Returns the value of attribute partial.



17
18
19
# File 'lib/refinery/pages/tab.rb', line 17

def partial
  @partial
end

#templatesObject

Returns the value of attribute templates.



17
18
19
# File 'lib/refinery/pages/tab.rb', line 17

def templates
  @templates
end

Class Method Details

.register {|tab| ... } ⇒ Object

Yields:

  • (tab)

Raises:

  • (ArgumentError)


19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/refinery/pages/tab.rb', line 19

def self.register(&block)
  tab = self.new

  yield tab

  raise ArgumentError, "A tab MUST have a name!: #{tab.inspect}" if tab.name.blank?
  raise ArgumentError, "A tab MUST have a partial!: #{tab.inspect}" if tab.partial.blank?

  tab.templates = %w[all] if tab.templates.blank?
  tab.templates = Array(tab.templates)

  tab
end