Class: Hippo::Templates::Base

Inherits:
Object
  • Object
show all
Includes:
Concerns::AttrAccessorWithDefault
Defined in:
lib/hippo/templates/base.rb

Direct Known Subclasses

Latex, Liquid

Class Method Summary collapse

Instance Method Summary collapse

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_nameObject


24
25
26
# File 'lib/hippo/templates/base.rb', line 24

def class_as_name
    self.class.to_s.demodulize.underscore
end

#extensionObject


36
37
38
# File 'lib/hippo/templates/base.rb', line 36

def extension
    '.' + defined_format.to_s
end

#filenameObject


28
29
30
# File 'lib/hippo/templates/base.rb', line 28

def filename
    class_as_name + self.extension
end

#pathnameObject


20
21
22
# File 'lib/hippo/templates/base.rb', line 20

def pathname
    root_path.join(filename)
end

#root_pathObject


16
17
18
# File 'lib/hippo/templates/base.rb', line 16

def root_path
    Hippo::ROOT_PATH.join('templates')
end

#sourceObject


32
33
34
# File 'lib/hippo/templates/base.rb', line 32

def source
    pathname.read
end