class GeoEngineer::Template

Override to define recommended patterns of resource use

Attributes

name[RW]
parameters[RW]
parent[RW]

Public Class Methods

new(name, parent, parameters = {}) click to toggle source
# File lib/geoengineer/template.rb, line 10
def initialize(name, parent, parameters = {})
  @name = name
  @parameters = parameters
  @parent = parent

  case parent
  when GeoEngineer::Project then add_project_attributes(parent)
  when GeoEngineer::Environment then add_env_attributes(parent)
  end
end

Public Instance Methods

add_env_attributes(environment) click to toggle source
# File lib/geoengineer/template.rb, line 27
def add_env_attributes(environment)
  @environment = environment
end
add_project_attributes(project) click to toggle source

Helper method to accomodate different parents

# File lib/geoengineer/template.rb, line 22
def add_project_attributes(project)
  @project = project
  @environment = project.environment
end
all_resources() click to toggle source
# File lib/geoengineer/template.rb, line 40
def all_resources
  resources
end
resource(type, id, &block) click to toggle source
# File lib/geoengineer/template.rb, line 31
def resource(type, id, &block)
  return find_resource(type, id) unless block_given?
  resource = create_resource(type, id, &block)
  resource.template = self
  resource.environment = @environment
  resource.project = @project if @project
  resource
end
template_resources() click to toggle source

The resources that are passed to the block on instantiation This can be overridden to specify the order of the templates resources

# File lib/geoengineer/template.rb, line 46
def template_resources
  resources
end