Class: Quintype::Liquid::Templates

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTemplates

Returns a new instance of Templates.



5
6
7
8
# File 'lib/quintype/liquid/templates.rb', line 5

def initialize
  @root = Rails.root.join("app", "views").to_s
  @paths = Dir.glob("#{@root}/**/*.liquid").sort
end

Instance Attribute Details

#pathsObject (readonly)

Returns the value of attribute paths.



3
4
5
# File 'lib/quintype/liquid/templates.rb', line 3

def paths
  @paths
end

Instance Method Details

#templatesObject



10
11
12
13
14
15
# File 'lib/quintype/liquid/templates.rb', line 10

def templates
  paths.reduce({}) do |acc, path|
    acc[clean_path(path)] = IO.read path
    acc
  end
end