Module: Fortitude::Widget::Doctypes::ClassMethods
- Defined in:
- lib/fortitude/widget/doctypes.rb
Instance Method Summary collapse
-
#doctype(new_doctype = nil) ⇒ Object
PUBLIC API.
Instance Method Details
#doctype(new_doctype = nil) ⇒ Object
PUBLIC API
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fortitude/widget/doctypes.rb', line 23 def doctype(new_doctype = nil) if new_doctype new_doctype = case new_doctype when Fortitude::Doctypes::Base then new_doctype when Symbol then Fortitude::Doctypes.standard_doctype(new_doctype) else raise ArgumentError, "You must supply a Symbol or an instance of Fortitude::Doctypes::Base, not: #{new_doctype.inspect}" end current_doctype = doctype if current_doctype if new_doctype != current_doctype raise ArgumentError, "The doctype has already been set to #{current_doctype} on this widget class or a superclass. You can't set it to #{new_doctype}; if you want to use a different doctype, you will need to make a new subclass that has no doctype set yet." end end if new_doctype. != nil self.(new_doctype.) end @_fortitude_doctype = new_doctype (new_doctype..values) else return @_fortitude_doctype if @_fortitude_doctype return superclass.doctype if superclass.respond_to?(:doctype) nil end end |