Class: Hippo::Templates::Base
- Inherits:
-
Object
- Object
- Hippo::Templates::Base
- Includes:
- Concerns::AttrAccessorWithDefault
- Defined in:
- lib/hippo/templates/base.rb
Class Method Summary collapse
Instance Method Summary collapse
- #class_as_name ⇒ Object
- #extension ⇒ Object
- #filename ⇒ Object
- #pathname ⇒ Object
- #root_path ⇒ Object
- #source ⇒ Object
Class Method Details
.format(fmt) ⇒ Object
12 13 14 |
# File 'lib/hippo/templates/base.rb', line 12 def self.format(fmt) self.defined_format = fmt end |
Instance Method Details
#class_as_name ⇒ Object
24 25 26 |
# File 'lib/hippo/templates/base.rb', line 24 def class_as_name self.class.to_s.demodulize.underscore end |
#extension ⇒ Object
36 37 38 |
# File 'lib/hippo/templates/base.rb', line 36 def extension '.' + defined_format.to_s end |
#filename ⇒ Object
28 29 30 |
# File 'lib/hippo/templates/base.rb', line 28 def filename class_as_name + self.extension end |
#pathname ⇒ Object
20 21 22 |
# File 'lib/hippo/templates/base.rb', line 20 def pathname root_path.join(filename) end |
#root_path ⇒ Object
16 17 18 |
# File 'lib/hippo/templates/base.rb', line 16 def root_path Hippo::ROOT_PATH.join('templates') end |
#source ⇒ Object
32 33 34 |
# File 'lib/hippo/templates/base.rb', line 32 def source pathname.read end |