New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve helper handling in Nanoc::Int::Context #1170

Merged
merged 1 commit into from May 14, 2017

Conversation

Projects
None yet
1 participant
@ddfreyne
Member

ddfreyne commented Apr 22, 2017

Fixes #1169.

This introduces use_helper to load helpers. Helpers loaded with use_helper will only be available in contexts where it makes sense, so they don’t pollute the global namespace.

module GreetingHelper
  def greeting
    'hello'
  end
end

use_helper GreetingHelper

@ddfreyne ddfreyne changed the title from Load code snippets in Nanoc::Int::Context to Include helpers in Nanoc::Int::Context Apr 23, 2017

@ddfreyne ddfreyne changed the title from Include helpers in Nanoc::Int::Context to Improve helper handling in Nanoc::Int::Context May 1, 2017

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne May 8, 2017

Member

This change makes the helpers not available in the Rules file. Making them available there would still be useful.

Member

ddfreyne commented May 8, 2017

This change makes the helpers not available in the Rules file. Making them available there would still be useful.

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne May 10, 2017

Member

This needs additional tests to verify the behavior of use_helper.

Member

ddfreyne commented May 10, 2017

This needs additional tests to verify the behavior of use_helper.

@ddfreyne ddfreyne merged commit 90d2c6d into master May 14, 2017

3 checks passed

codecov/patch 100% of diff hit (target 98.69%)
Details
codecov/project 98.7% (+0.01%) compared to b648a4a
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@ddfreyne ddfreyne deleted the helpers-in-nanoc-context branch May 14, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment