Sha256: 0dda154a96971edb6c02594d02871a8f35c69dd4c0242ed92e92cf77dc7209bc

Contents?: true

Size: 452 Bytes

Versions: 23

Compression:

Stored size: 452 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

23 entries across 23 versions & 3 rubygems

Version Path
bdimcheff-staticmatic-0.10.1 lib/staticmatic/mixins/helpers.rb
mattt-staticmatic-0.10.1 lib/staticmatic/mixins/helpers.rb
staticmatic-0.11.1 lib/staticmatic/mixins/helpers.rb
staticmatic-0.11.0 lib/staticmatic/mixins/helpers.rb
staticmatic-0.11.0.alpha.10 lib/staticmatic/mixins/helpers.rb
staticmatic-0.11.0.alpha.9 lib/staticmatic/mixins/helpers.rb
staticmatic-0.11.0.alpha.8 lib/staticmatic/mixins/helpers.rb
staticmatic-0.11.0.alpha.7 lib/staticmatic/mixins/helpers.rb
staticmatic-0.11.0.alpha.6 lib/staticmatic/mixins/helpers.rb
staticmatic-0.11.0.alpha.5 lib/staticmatic/mixins/helpers.rb
staticmatic-0.11.0.alpha.4 lib/staticmatic/mixins/helpers.rb
staticmatic-0.11.0.alpha.3 lib/staticmatic/mixins/helpers.rb
staticmatic-0.11.0.alpha.1 lib/staticmatic/mixins/helpers.rb
staticmatic-0.11.0.alpha.0 lib/staticmatic/mixins/helpers.rb
staticmatic-0.10.8 lib/staticmatic/mixins/helpers.rb
staticmatic-0.10.7 lib/staticmatic/mixins/helpers.rb
staticmatic-0.10.6 lib/staticmatic/mixins/helpers.rb
staticmatic-0.10.5 lib/staticmatic/mixins/helpers.rb
staticmatic-0.10.4 lib/staticmatic/mixins/helpers.rb
staticmatic-0.10.3 lib/staticmatic/mixins/helpers.rb