Skip to content
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
Copy link
Member

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 Load code snippets in Nanoc::Int::Context Include helpers in Nanoc::Int::Context Apr 23, 2017

@ddfreyne ddfreyne force-pushed the helpers-in-nanoc-context branch from f14a188 to b477cd9 Apr 23, 2017

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

@ddfreyne ddfreyne force-pushed the helpers-in-nanoc-context branch from 748038b to e57b707 May 1, 2017

@ddfreyne

This comment has been minimized.

Copy link
Member Author

commented May 8, 2017

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

@ddfreyne ddfreyne force-pushed the helpers-in-nanoc-context branch from e57b707 to 3f23208 May 10, 2017

@ddfreyne

This comment has been minimized.

Copy link
Member Author

commented May 10, 2017

This needs additional tests to verify the behavior of use_helper.

@ddfreyne ddfreyne force-pushed the helpers-in-nanoc-context branch 2 times, most recently from e2b4bbe to 98e7f28 May 13, 2017

@ddfreyne ddfreyne force-pushed the helpers-in-nanoc-context branch from 98e7f28 to f872077 May 14, 2017

@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
You can’t perform that action at this time.