Sha256: 7ab465c293cb814bc9c974ff17218edd7b3c63d0d7ffc8fcef2fb362c0f7e677

Contents?: true

Size: 467 Bytes

Versions: 2

Compression:

Stored size: 467 Bytes

Contents

module StaticMatic::HelpersMixin    
  # Loads any helpers present in the helpers dir and mixes them into the template helpers
  def load_helpers

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

  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
staticmatic3-2.1.10 lib/staticmatic/mixins/helpers.rb
staticmatic3-2.1.9 lib/staticmatic/mixins/helpers.rb