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

Add Arturo.foo_enabled_for?(feature_recipient) helper #14

Closed
jamesarosen opened this issue Jan 10, 2011 · 3 comments
Closed

Add Arturo.foo_enabled_for?(feature_recipient) helper #14

jamesarosen opened this issue Jan 10, 2011 · 3 comments
Labels

Comments

@jamesarosen
Copy link
Contributor

Something like

module Arturo
  ENABLED_FOR_METHOD_NAME = /^(\w+)_enabled_for\?$/
  def method_missing(symbol, *args, &block)
    if (args.length == 1 && match = ENABLED_FOR_METHOD_NAME.match(symbol.to_s))
      f = Arturo::Feature.to_feature(match[1])
      f && f.enabled_for(args.first)
    else
      super(symbol, *args, &block)
    end
  end
  def respond_to?(symbol)
    symbol.to_s =~ ENABLED_FOR_METHOD_NAME || super(symbol)
  end
end
@morten
Copy link

morten commented Feb 10, 2011

Bump ;-)

@jamesarosen
Copy link
Contributor Author

Resolved in efb3698

@morten
Copy link

morten commented Feb 14, 2011

Wee!

plukevdh pushed a commit to crunchy/arturo that referenced this issue Apr 23, 2012
@ghost ghost assigned jamesarosen May 1, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants