Sha256: ed485aa4382294787e0301197844b73089a7eceacc83a5eb924d4a05e437ed37
Contents?: true
Size: 924 Bytes
Versions: 18
Compression:
Stored size: 924 Bytes
Contents
require "active_support/core_ext/string" # Encapsulates helper methods and instance variables to be rendered in the ERB # templates. module AwsEc2::Template class Context include AwsEc2::Template::Helper def initialize(options={}) @options = options load_custom_helpers end private # Load custom helper methods from project def load_custom_helpers Dir.glob("#{AwsEc2.root}/app/helpers/**/*_helper.rb").each do |path| filename = path.sub(%r{.*/},'').sub('.rb','') module_name = filename.classify # Prepend a period so require works AWS_EC2_ROOT is set to a relative path # without a period. # # Example: AWS_EC2_ROOT=tmp/project first_char = path[0..0] path = "./#{path}" unless %w[. /].include?(first_char) require path self.class.send :include, module_name.constantize end end end end
Version data entries
18 entries across 18 versions & 1 rubygems