Class: Blogster::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/blogster/templates.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, name) ⇒ Template

Returns a new instance of Template.



29
30
31
32
# File 'lib/blogster/templates.rb', line 29

def initialize(path, name)
  @path = path
  @name = name
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



27
28
29
# File 'lib/blogster/templates.rb', line 27

def path
  @path
end

Instance Method Details

#==(other) ⇒ Object



46
47
48
49
# File 'lib/blogster/templates.rb', line 46

def ==(other)
  name == other.name &&
    path == other.path
end

#fileObject



34
35
36
# File 'lib/blogster/templates.rb', line 34

def file
  File.read(fullpath)
end

#fullpathObject



38
39
40
# File 'lib/blogster/templates.rb', line 38

def fullpath
  File.join(path, @name)
end

#nameObject



42
43
44
# File 'lib/blogster/templates.rb', line 42

def name
  @suffixless_name ||= @name.delete('.md')
end