module StaticMatic::HelpersMixin

Public Instance Methods

load_helper(helper) click to toggle source
# File lib/staticmatic/mixins/helpers.rb, line 10
def load_helper(helper)
  load helper
  module_name = File.basename(helper, '.rb').gsub(/(^|\_)./) { |c| c.upcase }.gsub(/\_/, '')
  Haml::Helpers.class_eval("include #{module_name}")
end
load_helpers() click to toggle source

Loads any helpers present in the helpers dir and mixes them into the template helpers

# File lib/staticmatic/mixins/helpers.rb, line 3
def load_helpers

  Dir["#{@src_dir}/_helpers/**/*_helper.rb"].each do |helper|
    load_helper(helper)
  end
end