Class: DiceBag::AvailableTemplates
- Inherits:
-
Object
- Object
- DiceBag::AvailableTemplates
- Defined in:
- lib/dice_bag/available_templates.rb
Direct Known Subclasses
Class Method Summary collapse
- .all ⇒ Object
- .inherited(base) ⇒ Object
- .template_checkers ⇒ Object
- .template_filename_for(filename) ⇒ Object
Class Method Details
.all ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dice_bag/available_templates.rb', line 16 def all #all the classes than inherit from us in the ruby runtime available_templates = [] template_checkers.each do |checker| checker.new.templates.each do |template| available_templates.push( template) end end available_templates end |
.inherited(base) ⇒ Object
12 13 14 |
# File 'lib/dice_bag/available_templates.rb', line 12 def inherited(base) template_checkers << base end |
.template_checkers ⇒ Object
8 9 10 |
# File 'lib/dice_bag/available_templates.rb', line 8 def template_checkers @template_checkers ||= [] end |
.template_filename_for(filename) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/dice_bag/available_templates.rb', line 28 def template_filename_for(filename) self.all.each do |template_filename| if template_filename.include? filename return template_filename end end end |