Sha256: 59093fb38e5dcf2b6b50566a98b48a371312adb6f726e2c8604302451c8d20a5
Contents?: true
Size: 639 Bytes
Versions: 10
Compression:
Stored size: 639 Bytes
Contents
# encoding: utf-8 module Nanoc3::Extra # Nanoc3::Extra::Context provides a context and a Binding for use in various # filters, such as the ERB and Haml one. class Context # Creates a new context based off the contents of the hash. Each pair in # the hash will be converted to an instance variable. For example, passing # the hash { :foo => 'bar' } will cause @foo to have the value "bar". def initialize(hash) hash.each_pair do |key, value| instance_variable_set('@' + key.to_s, value) end end # Returns a binding for this context. def get_binding binding end end end
Version data entries
10 entries across 10 versions & 1 rubygems