Sha256: f80ef5dc7a252359bb4f561ef65c0bc49794bb449ac0831460ec9e6f52a24b26

Contents?: true

Size: 360 Bytes

Versions: 10

Compression:

Stored size: 360 Bytes

Contents

# frozen_string_literal: true

module Maglev
  module Content
    class Checkbox < Base
      def true?
        !!cast_content
      end

      def false?
        !true?
      end

      def to_s
        content
      end

      private

      def cast_content
        @cast_content ||= ActiveModel::Type::Boolean.new.cast(content)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
maglevcms-1.8.0 app/components/maglev/content/checkbox.rb
maglevcms-1.7.3 app/components/maglev/content/checkbox.rb
maglevcms-1.7.2 app/components/maglev/content/checkbox.rb
maglevcms-1.7.1 app/components/maglev/content/checkbox.rb
maglevcms-1.7.0 app/components/maglev/content/checkbox.rb
maglevcms-1.6.1 app/components/maglev/content/checkbox.rb
maglevcms-1.6.0 app/components/maglev/content/checkbox.rb
maglevcms-1.5.1 app/components/maglev/content/checkbox.rb
maglevcms-1.4.0 app/components/maglev/content/checkbox.rb
maglevcms-1.3.0 app/components/maglev/content/checkbox.rb