Sha256: 546e12547d21795378153a60ce1223bf4880d0ee261ad10c222f4e5d00de2908

Contents?: true

Size: 1.08 KB

Versions: 8

Compression:

Stored size: 1.08 KB

Contents

# typed: true
# frozen_string_literal: true

begin
  require "active_record"
rescue LoadError
  return
end

module Tapioca
  module Dsl
    module Compilers
      module Extensions
        module ActiveRecord
          attr_reader :__tapioca_delegated_types

          def delegated_type(role, types:, **options)
            @__tapioca_delegated_types ||= {}
            @__tapioca_delegated_types[role] = { types: types, options: options }

            super
          end

          attr_reader :__tapioca_secure_tokens

          def has_secure_token(attribute = :token, **)
            @__tapioca_secure_tokens ||= []
            @__tapioca_secure_tokens << attribute

            super
          end

          attr_reader :__tapioca_stored_attributes

          def store_accessor(store_attribute, *keys, prefix: nil, suffix: nil)
            @__tapioca_stored_attributes ||= []
            @__tapioca_stored_attributes << [store_attribute, keys, prefix, suffix]

            super
          end

          ::ActiveRecord::Base.singleton_class.prepend(self)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tapioca-0.11.17 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.11.16 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.11.15 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.11.14 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.11.13 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.11.12 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.11.11 lib/tapioca/dsl/extensions/active_record.rb
tapioca-0.11.10 lib/tapioca/dsl/extensions/active_record.rb