Class: Lono::Template::Context

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Includes:
Helpers, Loader, Dsl::Builder::Syntax, Helper
Defined in:
lib/lono/template/context.rb,
lib/lono/template/context/loader.rb,
lib/lono/template/context/helpers.rb,
lib/lono/template/context/ssm_fetcher.rb

Defined Under Namespace

Modules: Helpers, Loader Classes: SsmFetcher

Constant Summary

Constants included from Dsl::Builder::Fn

Dsl::Builder::Fn::FUNCTIONS

Instance Method Summary collapse

Methods included from Dsl::Builder::Helpers::ParamHelper

#conditional_parameter, #normalize_conditional_parameter_options, #optional_ref, #parameter

Methods included from Dsl::Builder::Helpers::CoreHelper

#content, #dimensions, #file_s3_key, #render_file, #render_path, #s3_bucket, #setting, #stack_name, #tag_list, #tags, #user_data, #user_data_script

Methods included from Dsl::Builder::SectionMethods

#aws_template_format_version, #condition, #description, #mapping, #metadata, #output, #parameter, #resource, #section, #transform

Methods included from Evaluate

#evaluate_template_path, #template_evaluation_error

Methods included from Dsl::Builder::Fn

#conditional_ref, define_methods, #fn, #fn_id, #get_att, #get_azs, included, #join, #ref, #sub

Methods included from Helpers

#ssm, #ssm_fetcher

Methods included from Helper

#current_region, #extract_scripts, #indent, #partial, #partial_exist?, #scripts_name, #scripts_s3_path, #template_params, #template_s3_path, #user_data

Constructor Details

#initialize(blueprint, options = {}) ⇒ Context

Returns a new instance of Context.



10
11
12
13
14
# File 'lib/lono/template/context.rb', line 10

def initialize(blueprint, options={})
  @blueprint, @options = blueprint, options
  load_variables
  load_project_helpers
end

Instance Method Details

#instance_variables!(variables) ⇒ Object

Take a hash and makes them instance variables in the current scope. Use this in custom helper methods to make variables accessible to ERB templates.



18
19
20
21
22
# File 'lib/lono/template/context.rb', line 18

def instance_variables!(variables)
  variables.each do |key, value|
    instance_variable_set('@' + key.to_s, value)
  end
end