class FFeature::Feature
Attributes
feature[R]
Public Class Methods
new(feature)
click to toggle source
# File lib/ffeature/feature.rb, line 6 def initialize(feature) @feature = feature end
Public Instance Methods
enabled?(user = nil)
click to toggle source
# File lib/ffeature/feature.rb, line 10 def enabled?(user = nil) return true if FFeature.dev_mode if flipper_user?(user) FFeature.flipper[feature].enabled?(user.to_model) else FFeature.flipper[feature].enabled? end end
Private Instance Methods
flipper_user?(user)
click to toggle source
# File lib/ffeature/feature.rb, line 22 def flipper_user?(user) user.respond_to?(:to_model) && user.respond_to?(:flipper_id) end