Sha256: d63aa3370c458047e755c137623f09c5c8d6d271816f197c70312501a2422584

Contents?: true

Size: 661 Bytes

Versions: 7

Compression:

Stored size: 661 Bytes

Contents

class IndexController < ApplicationController
  def show
    is_colloquial = determinator.feature_flag_on?(:colloquial_welcome)
    emoji = determinator.which_variant(:welcome_emoji)

    message = [
      is_colloquial ? "hi world" : "hello world",
      (emoji if emoji)
    ].compact.join(" ")

    explain = "An experiment and a feature flag are being checked for the user with guid #{guid}. "
    explain += "The feature flag (colloquial_welcome) is #{is_colloquial ? 'on' : 'off'}. "
    explain += "The experiment (welcome_emoji) returned #{emoji}#{", so is omitted" unless emoji}."

    render json: { welcome: message, explanation: explain }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
determinator-2.9.3 examples/determinator-rails/app/controllers/index_controller.rb
determinator-2.9.2 examples/determinator-rails/app/controllers/index_controller.rb
determinator-2.9.1 examples/determinator-rails/app/controllers/index_controller.rb
determinator-2.9.0 examples/determinator-rails/app/controllers/index_controller.rb
determinator-2.8.0 examples/determinator-rails/app/controllers/index_controller.rb
determinator-2.7.1 examples/determinator-rails/app/controllers/index_controller.rb
determinator-2.7.0 examples/determinator-rails/app/controllers/index_controller.rb