Class: Sitepress::ConfigurationFile

Inherits:
Object
  • Object
show all
Defined in:
lib/sitepress/project.rb

Overview

Evaluates a configuration file to configure a site.

Defined Under Namespace

Classes: Context

Instance Method Summary collapse

Constructor Details

#initialize(path: Project::DEFAULT_CONFIG_FILE) ⇒ ConfigurationFile

Returns a new instance of ConfigurationFile.


33
34
35
# File 'lib/sitepress/project.rb', line 33

def initialize(path: Project::DEFAULT_CONFIG_FILE)
  @path = Pathname.new(path)
end

Instance Method Details

#parse(site: Sitepress::Site.new) ⇒ Object


37
38
39
40
41
# File 'lib/sitepress/project.rb', line 37

def parse(site: Sitepress::Site.new)
  site.tap do |s|
    Context.new(s).instance_eval File.read(@path), @path.to_s
  end
end