Sha256: 5aa8a84483e117002c58732b44d6aea39d66125fef2e84b1598382697f6a115e

Contents?: true

Size: 480 Bytes

Versions: 73

Compression:

Stored size: 480 Bytes

Contents

# frozen_string_literal: true

module Alchemy
  module Ingredients
    # A boolean value
    #
    class Boolean < Alchemy::Ingredient
      def value
        ActiveRecord::Type::Boolean.new.cast(self[:value])
      end

      # The localized value
      #
      # Used by the Element#preview_text method.
      #
      def preview_text(_max_length = nil)
        return if value.nil?

        Alchemy.t(value.to_s, scope: "ingredient_values.boolean")
      end
    end
  end
end

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
alchemy_cms-7.4.2 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.3.6 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.2.9 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.4.1 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.4.0 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.3.5 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.2.8 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.1.13 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.0.16 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.3.4 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.3.3 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.3.2 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.2.7 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.3.1 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.3.0 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.2.6 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.2.5 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.1.12 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-7.0.15 app/models/alchemy/ingredients/boolean.rb
alchemy_cms-6.1.10 app/models/alchemy/ingredients/boolean.rb