Class: FFeature::Feature

Inherits:
Object
  • Object
show all
Defined in:
lib/ffeature/feature.rb

Instance Method Summary collapse

Constructor Details

#initialize(feature) ⇒ Feature

Returns a new instance of Feature.



6
7
8
# File 'lib/ffeature/feature.rb', line 6

def initialize(feature)
  @feature = feature
end

Instance Method Details

#enabled?(user = nil) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
17
18
# 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