Class: PageFactory::Base
- Inherits:
-
Object
- Object
- PageFactory::Base
- Includes:
- Annotatable
- Defined in:
- lib/page_factory/base.rb
Class Attribute Summary collapse
-
.parts ⇒ Object
Returns the value of attribute parts.
Class Method Summary collapse
- .descendants ⇒ Object
- .inherited(subclass) ⇒ Object
-
.part(name, attrs = {}) ⇒ Object
Add a part to this PageFactory.
-
.remove(*names) ⇒ Object
Remove a part from this PageFactory.
Class Attribute Details
.parts ⇒ Object
Returns the value of attribute parts.
8 9 10 |
# File 'lib/page_factory/base.rb', line 8 def parts @parts end |
Class Method Details
.descendants ⇒ Object
47 48 49 50 |
# File 'lib/page_factory/base.rb', line 47 def descendants load_descendants super end |
.inherited(subclass) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/page_factory/base.rb', line 10 def inherited(subclass) subclass.parts = @parts.dup subclass.layout = layout subclass.page_class = page_class subclass.template_name = subclass.name.to_name('Factory') end |
.part(name, attrs = {}) ⇒ Object
Add a part to this PageFactory
29 30 31 32 |
# File 'lib/page_factory/base.rb', line 29 def part(name, attrs={}) remove name @parts << PagePart.new(attrs.merge(:name => name)) end |
.remove(*names) ⇒ Object
Remove a part from this PageFactory
42 43 44 45 |
# File 'lib/page_factory/base.rb', line 42 def remove(*names) names = names.map(&:downcase) @parts.delete_if { |p| names.include? p.name.downcase } end |