Sha256: a21f2ae83b4ca089faa9dfd2802ba7d8355cb222eacaf6f956ade2bfa0e1a57c

Contents?: true

Size: 647 Bytes

Versions: 12

Compression:

Stored size: 647 Bytes

Contents

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

    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

12 entries across 12 versions & 1 rubygems

Version Path
lono-5.2.8 lib/lono/template/context.rb
lono-5.2.7 lib/lono/template/context.rb
lono-5.2.6 lib/lono/template/context.rb
lono-5.2.5 lib/lono/template/context.rb
lono-5.2.4 lib/lono/template/context.rb
lono-5.2.3 lib/lono/template/context.rb
lono-5.2.2 lib/lono/template/context.rb
lono-5.2.1 lib/lono/template/context.rb
lono-5.2.0 lib/lono/template/context.rb
lono-5.1.1 lib/lono/template/context.rb
lono-5.1.0 lib/lono/template/context.rb
lono-5.0.1 lib/lono/template/context.rb