Sha256: fdb6706565cabe9bac650ad624ec1f9f15ab6c0ad80b5b21ce5610901e689d1f

Contents?: true

Size: 686 Bytes

Versions: 6

Compression:

Stored size: 686 Bytes

Contents

# Encapsulates helper methods and instance variables to be rendered in the ERB templates.
class Lono::Template
  class Context
    extend Memoist
    include Lono::Template::Helper
    include Loader
    include Helpers

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

    # 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.
    def instance_variables!(variables)
      variables.each do |key, value|
        instance_variable_set('@' + key.to_s, value)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lono-6.0.0 lib/lono/template/context.rb
lono-5.3.4 lib/lono/template/context.rb
lono-5.3.3 lib/lono/template/context.rb
lono-5.3.2 lib/lono/template/context.rb
lono-5.3.1 lib/lono/template/context.rb
lono-5.3.0 lib/lono/template/context.rb