Module: Arturo

Defined in:
app/controllers/arturo/features_controller.rb,
lib/arturo.rb,
lib/arturo/engine.rb,
lib/arturo/version.rb,
lib/arturo/middleware.rb,
lib/arturo/null_logger.rb,
lib/arturo/feature_caching.rb,
lib/arturo/feature_methods.rb,
lib/arturo/no_such_feature.rb,
lib/arturo/special_handling.rb,
lib/arturo/controller_filters.rb,
lib/arturo/feature_management.rb,
lib/arturo/feature_availability.rb,
lib/arturo/feature_params_support.rb,
app/helpers/arturo/features_helper.rb,
lib/generators/arturo/assets_generator.rb,
lib/generators/arturo/routes_generator.rb,
lib/generators/arturo/templates/feature.rb,
lib/generators/arturo/migration_generator.rb,
lib/generators/arturo/initializer_generator.rb,
lib/generators/arturo/feature_model_generator.rb

Overview

TODO: this doesn’t do anything radically out of the ordinary.

Are there Rails 3 patterns/mixins/methods I can use
to clean it up a bit?

Defined Under Namespace

Modules: ControllerFilters, FeatureAvailability, FeatureCaching, FeatureManagement, FeatureMethods, FeatureParamsSupport, FeaturesHelper, SpecialHandling Classes: AssetsGenerator, Engine, Feature, FeatureModelGenerator, FeaturesController, InitializerGenerator, Middleware, MigrationGenerator, NoSuchFeature, NullLogger, RoutesGenerator

Constant Summary collapse

VERSION =
'4.1.1'

Class Method Summary collapse

Class Method Details

.feature_enabled_for?(feature_name, recipient) ⇒ true, false

Quick check for whether a feature is enabled for a recipient.

Parameters:

  • feature_name (String, Symbol)
  • recipient (#id)

Returns:

  • (true, false)

    whether the feature exists and is enabled for the recipient



17
18
19
20
21
22
# File 'lib/arturo.rb', line 17

def feature_enabled_for?(feature_name, recipient)
  return false if recipient.nil?

  f = self::Feature.to_feature(feature_name)
  f && f.enabled_for?(recipient)
end

.loggerObject



28
29
30
# File 'lib/arturo.rb', line 28

def logger
  @logger || NullLogger.new
end

.logger=(logger) ⇒ Object



24
25
26
# File 'lib/arturo.rb', line 24

def logger=(logger)
  @logger = logger
end